DomAPI Home
DomAPI
Build: Not Applicable
Topic: Centering a grid

  APStore not registered wrote on Wednesday 12/7/05 at 5:12 PM (PST)  
 

What command do I need to use to force this grid to always be centered on my web page?

<script language="JavaScript" type="text/JavaScript">
<!--
var position = -1;
core.loadUnit("listgrid");
onload=function(){
elm1=Listgrid({w:780,h:100,hasFooter:false});
elm1.addCol({caption:"Date",w:85,hint:"Date",align:"left"});
elm1.addCol({caption:"Counselor Number",w:100,hint:"Counselor Number",align:"left"});
elm1.addCol({caption:"Charge Code",w:100,hint:"Charge Code",align:"left"});
elm1.addCol({caption:"Time Units",w:100,hint:"Time Units",align:"left"});
elm1.addCol({caption:"Notes",w:375,hint:"Notes",align:"left"});
elm1.addRow("7 Dec. 2005,12345,x3,4,All work and no play makes Jack a dull boy. All work and no...").url="enternotes.asp?casenumber=G11111&ID=100";
elm1.addRow("17 Nov. 2004,12345,xxx,0.07,The note is new my shirt is blue and now my work day is all ...").url="enternotes.asp?casenumber=G11111&ID=93";
elm1.addRow("17 Nov. 2004,12345,x3,0.04,a;lsdkjf a;sdlkfj a;sdklj a;lskdj fa;sdkljf a;djkflasd fasdf...").url="enternotes.asp?casenumber=G11111&ID=92";
elm1.addRow("2 Nov. 2004,12345,x2,6,Lawyer").url="enternotes.asp?casenumber=G11111&ID=6";
elm1.onchange = function(){
SetCookie(position,core.getNodeIndex(this.selected[0]));
location.href = this.selected[0].url;
}
elm1.deselectAll();
elm1.selectRow(elm1.rows[GetCookie(position)]);
}
//-->
</script>
William A Jorgensen

 
    RSS feed of forum  
  Henry registered v4 wrote on Wednesday 12/7/05 at 6:07 PM (PST)  
 

use position:"relative" or put it inside another container. then control the position with css.


Henry

 
    RSS feed of forum  
  APStore not registered wrote on Wednesday 12/7/05 at 6:13 PM (PST)  
 

when you say "position:"relative"" what is the code string? something like this:

elm1.position:"relative"

Thanks.
William A Jorgensen

 
    RSS feed of forum  
  APStore not registered wrote on Wednesday 12/7/05 at 7:21 PM (PST)  
 

okay I tried this, still doesn't center:

<!--
var position = -1;
core.loadUnit("listgrid");
onload=function(){
elm1=Listgrid({x:25,y:80,w:780,h:100,hasFooter:false});
elm1.style.position="relative";
elm1.addCol({caption:"Date",w:85,hint:"Date",align:"left"});
elm1.addCol({caption:"Counselor Number",w:100,hint:"Counselor Number",align:"left"});
elm1.addCol({caption:"Charge Code",w:100,hint:"Charge Code",align:"left"});
elm1.addCol({caption:"Time Units",w:100,hint:"Time Units",align:"left"});
elm1.addCol({caption:"Notes",w:375,hint:"Notes",align:"left"});
elm1.addRow("7 Dec. 2005,12345,x3,4,All work and no play makes Jack a dull boy. All work and no...").url="enternotes.asp?casenumber=G11111&ID=100";
elm1.addRow("17 Nov. 2004,12345,xxx,0.07,The note is new my shirt is blue and now my work day is all ...").url="enternotes.asp?casenumber=G11111&ID=93";
elm1.addRow("17 Nov. 2004,12345,x3,0.04,a;lsdkjf a;sdlkfj a;sdklj a;lskdj fa;sdkljf a;djkflasd fasdf...").url="enternotes.asp?casenumber=G11111&ID=92";
elm1.addRow("2 Nov. 2004,12345,x2,6,Lawyer").url="enternotes.asp?casenumber=G11111&ID=6";
elm1.onchange = function(){
SetCookie(position,core.getNodeIndex(this.selected[0]));
location.href = this.selected[0].url;
}
elm1.deselectAll();
elm1.selectRow(elm1.rows[GetCookie(position)]);
}
//-->
</script>
William A Jorgensen

 
    RSS feed of forum  
  Henry registered v4 wrote on Thursday 12/8/05 at 7:59 AM (PST)  
 


you can either move to center with javascript when it is absolute positioned.

else, by giving it relative postion or a parent container. it enable you to use css to center it.

it is no differen from centering a simple div in a page.


Henry
btw, you need beginUpdate and endUpdate to warp around your grid updating code.

 
    RSS feed of forum  
  APStore not registered wrote on Thursday 12/8/05 at 12:51 PM (PST)  
 

That elm1.beginUpdate(); gives me the error that object does not support property, can you give me some sample code? I put div center around the script but it still doesn't center, can you give me a sample of that as well?




<script language="JavaScript" type="text/JavaScript">
<!--
var position = -1;
core.loadUnit("listgrid");
onload=function(){
elm1=Listgrid({x:25,y:80,w:780,h:100,hasFooter:false});
elm1.beginUpdate();
elm1.addCol({caption:"Date",w:85,hint:"Date",align:"left"});
elm1.addCol({caption:"Counselor Number",w:100,hint:"Counselor Number",align:"left"});
elm1.addCol({caption:"Charge Code",w:100,hint:"Charge Code",align:"left"});
elm1.addCol({caption:"Time Units",w:100,hint:"Time Units",align:"left"});
elm1.addCol({caption:"Notes",w:375,hint:"Notes",align:"left"});
elm1.addRow("7 Dec. 2005,12345,x3,4,All work and no play makes Jack a dull boy. All work and no...").url="enternotes.asp?casenumber=G11111&ID=100";
elm1.addRow("17 Nov. 2004,12345,xxx,0.07,The note is new my shirt is blue and now my work day is all ...").url="enternotes.asp?casenumber=G11111&ID=93";
elm1.addRow("17 Nov. 2004,12345,x3,0.04,a;lsdkjf a;sdlkfj a;sdklj a;lskdj fa;sdkljf a;djkflasd fasdf...").url="enternotes.asp?casenumber=G11111&ID=92";
elm1.addRow("2 Nov. 2004,12345,x2,6,Lawyer").url="enternotes.asp?casenumber=G11111&ID=6";
elm1.endUpdate();
elm1.onchange = function(){
SetCookie(position,core.getNodeIndex(this.selected[0]));
location.href = this.selected[0].url;
}
elm1.deselectAll();
elm1.selectRow(elm1.rows[GetCookie(position)]);
}
//-->
</script>
William A Jorgensen

 
    RSS feed of forum  
  Darin Kadrioski registered v4 wrote on Thursday 12/8/05 at 1:04 PM (PST)  
 

3.0 ?

 
    RSS feed of forum  
  APStore not registered wrote on Thursday 12/8/05 at 1:20 PM (PST)  
 

Yes 3.01, I tried to run the same code with the 4.0 beta, but it would not work.
William A Jorgensen

 
    RSS feed of forum  
You could respond to this post if you were logged in.
DHTML by www.domapi.com