0

I am using jqgrid with ASP.NET MVC 3.

I want to hide the sub grid's '+' option, based on some value from one of the main grid column.

For example. I have a grid with the following columns

  • Name
  • Cars
  • Salary
  • CarCount

Now if the if the CarCount is > 0 then I want a subgrid which I have done and is working.

But for CarCount = 0 I dont want to show an empty subgrid, so in such cases I want to remove the expand option itself.

Please help on this.

Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281

1 Answers1

0

I got this !

I used the afterInsertRow option of jqgrid, however this does not work until you remove gridview: true

However I am still struggling to find out why I had to remove gridview:true see this

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

I hope this is useful for someone in future..

Community
  • 1
  • 1
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281