I am new to this, please forgive my n00b question. I have searched through the documentation and forum, but I could not find an easy answer for printing row numbers in a grid. Any help?
Here is what I am doing:
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.attachHeader("#text_filter,#text_filter,#numeric_filter,#numeric_filter,#select_filter,#select_filter,#text_filter,#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter");
mygrid.setImagePath('../codebase/imgs/');
mygrid.setHeader("Gene,Pathway,Exp_Sum,Log_Ratio,Diff_Exp_Flag,Exp_String,ID:Start-Stop,S1,S2,S3,S4,S5,S6");
mygrid.setInitWidths("100,100,100,70,90,160,200,50,50,50,50,50,50");
mygrid.setColAlign("center,center,center,center,center,center,center,right,right,right,right,right,right");
mygrid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
mygrid.setColSorting("str,str,int,int,int,int,str,int,int,int,int,int,int");
mygrid.setSkin("dhx_skyblue")
mygrid.init();
mygrid.enableSmartRendering(true);
mygrid.loadXML("test.xml");
var z = mygrid.rowsCol.length;
document.write("<p>Row Count: " + z + "</p>");
</script>
I am getting zero for the Row Count…Any help appreciated.
Anybody?
Does your test.xml have any data?
You should wait till rows are fully loaded:
mygrid.loadXML("test.xml",function(){
var z = mygrid.rowsCol.length;
document.write("<p>Row Count: " + z + "</p>");
});
I tried
mygrid.loadXML("test.xml",function(){
var z = mygrid.rowsCol.length;
document.write("<p>Row Count: " + z + "</p>");
});
But, this just refreshes the screen…I apologize, I am very new to JS, Is there any other way i can get total rows including the rows not displayed?
*refreshes the screen and gives a count of 30…i know there are more than that
Alright, I changed the code to do
[code] mygrid.loadXML(“demo.xml”,window.onload=function(){
document.getElementById(“num”).innerHTML=mygrid.getRowsNum();
});
But it does not update when I manipulate the rows…
In your html page you must have something like this
Rows count:
In script like this
var row_count = document.getElementById(‘row_count’);
mygrid.loadXML(data_url, function(){
var state=mygrid.getStateOfView();
row_count.value= state[2];
//or
row_count.value= mygrid.getRowsNum();
});
Thank you for response.
I have updated the code:
[code]
Row count:
[/code]
Initial row count is 58192, but when I added a filter(Ex: Column 3 >1000)…the number of rows is reduced to 19 but the count is not updated.
Any help is appreciated.
Am I missing something obvious? Anybody?
Still waiting…Please help…