Search code examples
phpzend-frameworkzend-dbzfdatagrid

Conditional Fields Presentation


I have a table with 4 field named as Rowid,Customermainid,company,email.

I wanna add class attribute to the particular row which satisfies the following condition Rowid > 28 for differentiate them

I have searched a lot and get $grid->setClassRowCondition("{{Rowid}} > 28","green"); from here

But it doesn't work for me. What am i doing wrong with this code? Help me guys!

EDIT

I have found the reason for my question.

The given link works well only for the grid which is loaded by Bvb_Grid_Deploy_Table class.

But i have load my grid with the use of Bvb_Grid_Deploy_JqGrid class.

So only it doesn't work.

I found only the reason, not an answer.

I have found one more option

$grid->updateColumn('field',array('hRow'=>true));

This also doesn't work.

If anybody know the answer,guide me guys!


Solution

  • Yeah, I have found the solution of my problem. I have add the following code to jquery.jqGrid.min.js file

    va=srvr[0];
    if(va>28)
     {
      return'<td role="gridcell" class="test" '+prp+' title="'+$.jgrid.stripHtml(v)+'">'+v+"</td>"
     }
    else
     {
      return'<td role="gridcell" '+prp+' title="'+$.jgrid.stripHtml(v)+'">'+v+"</td>"
     }
    

    In the above code srvr contain whole row value. srvr[0] have rowid value