tags:

views:

168

answers:

4

Hi

I am using jqGrid with subGrid. But at some row i do not want to show the Plus icon. Because i do not want to allow user to view the subgrid on that perticular row. So can any body help me how to hide the plus icon over there. I tried with the below code but no luck.

afterInsertRow : function(rowid, rowdata, rowelem) {
$("tr[id="+rowid+"]>td.ui-sgcollapsed>a")
                           .click(function(){return false;})
}

By doing above i can disable the Plus icon that is on click of plus icon subgrid will not open. But, my requirement is to not to show the Plus icon at all. when i am doing like below then borders are not coming in IE6 while in mozila borders are coming.

$("tr#1.ui-widget-content td:first span").removeAttr("class");

Also by wrting above code it is on click of the cell again Plus icon comes up.

Can any body tell me how to hide plus icon. and disable its click event?

A: 

Try using the onGridComplete event. When the grid is completed loading you will need to find the rows that you want to remove the plus icon from. Finally, remove the class that is used to determine the style of the plus icon

John Hartsock
Sounds like a reasonable approach. Do you have any example code to get him started?
Justin Ethier
A: 

Thanks for your reply,

However, I tried to hide it at onGridcomplete while removing class it is hiding but when i click on the td then again minus sign comes up and it again on click of minus icon plus icon comes up. if i am hiding plus icon by removing class and also returning false on click of then also minus icon is coming. I tried the above at afterinsert event also. But no luck.

did any body never find this kind of requirement? I guess it should be there in jqGrid to disable expandable collapse icons on conditional basis.

Because say there may be chances that for every row we may not get data for showing subgrid. At that time it is worthless to show the expandable icon.

Can any body throw some light on this how to hide expandable icon?

Rupesh
A: 

Anyone find the answer to this?

john
A: 

This works for me.

afterInsertRow: function(rowid, rowdata, rowelem) {
      $("tr[id=" + rowid + "]>td:first").removeAttr("class");
      $("tr[id=" + rowid + "]>td:first").html(" ");
}
nak