Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stevo on Apr 23, 2008 06:54
open dhtmlx forum
[GRID] Make certain row opened initially (with pagination)

I am using sub_row_ajax and would like to open one of rows (identified by id) initially...

The following code doesn't work... I suspect that it is triggered a little bit to early (before rows were actually rendered). Can You tell me how to fix it?

<% if options[:open_node] %>
grid_<%=random_id%>.attachEvent("onXLE",function(id){
grid_<%=random_id%>._collapsMonolite();
grid_<%=random_id%>.cells('<%= options[:open_node] %>',0).open();
grid_<%=random_id%>.setSizes();
return true;
});
<% end %>

The second question is : Will it work if pagination is on? Will it automatically move to proper page, and open required row? It would be nice if it does...
Answer posted by Support on Apr 23, 2008 07:23
>> Will it automatically move to proper page, and open required row
It will not work in such manner but can be easily updated to do such task

grid_.attachEvent("onXLE",function(id){
    grid_._collapsMonolite();
    grid_.getRowById(some);   //will parse row if it still in buffer
    grid_.showRow(some); // will switch grid to necessary page and set scrollbar so row will be visible
    grid_.cells('some',0).open();
    grid_.setSizes();
    return true;
});


>>I suspect that it is triggered a little bit to early
Actually the onXLE  called when data loaded for sure, but in case of paging or smart rendering the row may stay not parsed in buffer, which may cause error during cells operation.
To be sure that row parsed you can use code provided in sample above