Hello, how can i hide the "+" button in a master grid when the subgrid have no rows?
I can use a master grid field to define when hide or show the "+" button ?
Thanks
Hi,
1) Connect onload event with grid.
$opt["loadComplete"] = "function(){ do_onload(); }";
2) Write callback function to iterate the master rows for your condition in desired column, and remove the td of +/- sign.
for e.g. to remove + sign from gender = male …
<script>
function do_onload()
{
var grid = $("#list1");
var ids = grid.jqGrid('getDataIDs');
for (var i=0;i<ids.length;i++)
{
var id=ids[i];
if (grid.jqGrid('getCell',id,'gender') == 'male')
{
jQuery('tr#'+i+' td.ui-sgcollapsed').replaceWith('<td>');
}
}
}
</script>
Full source: subgrid.php
http://pastebin.com/DbLsHPrM
Hello Abu, thanks for your reply!
I fix this line
jQuery('tr#'+i+' td.ui-sgcollapsed').replaceWith('<td>');
with
jQuery('tr#'+id+' td.ui-sgcollapsed').replaceWith('<td>');
and it works, thanks!
Hello,
It is not recommended practice to load 2000+ records at a time.
It also consume too much of browser memory (due to js processing).
What i recommend is to load data on-demand, for e.g. when page is scrolled down, it would load next page. e.g.
$opt["scroll"]=true;
$g->set_options($opt);
Hi Abu, with this method i'm having problems like long loading time on a 2000+ record table (like 3 minutes of loading vs 15sec without do_onload method).
Because the grid puts the "+" on every row (if exist or not a subgrid result row), this method will scan all rows and results very laggy.
So, can you provide me a method to filter the "+" button when the grid is building the rows?
Thanks!
Hi Abu, thanks for your response.
I'm trying this options:
$g = new jqgrid();
$grid["rowNum"] = 150;
$grid["scroll"] = true;
$g->set_options($grid);
I'm scrolling down but it shows still 150 rows, so how it works?
Thanks
I tried also $grid["rowNum"] = 0; and $grid["rowNum"] = 2000; and without specifying a rowNum but, but i can't see the scroll option in action.
thanks