payu2107 / zii

Automatically exported from code.google.com/p/zii
0 stars 0 forks source link

[PATCH] CGridView rowIdExpression #31

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This patch add a "rowIdExpression" property to CGridView, making possible
setting a different id for each <tr>, to allow JavaScript access, for
example, when using Table Drag and Drop JQuery plugin
(http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/)

Original issue reported on code.google.com by rangels...@gmail.com on 10 Mar 2010 at 1:43

Attachments:

GoogleCodeExporter commented 8 years ago
You can use $.fn.yiiGridView.getRow('grid', i) to get the <tr> set.

Original comment by qiang.xue on 10 Mar 2010 at 8:48

GoogleCodeExporter commented 8 years ago
The intent was not to get the row in javascript, the intent is to identify which
database row the table row came from, probably embedding the primary key into 
the
"id" field, like:

<tr id="product-10">
...
</tr>
<tr id="product-15">
...
</tr>

So I can make an ajax request for this row, parsing the primary key from the 
"id"
property.

Original comment by rangels...@gmail.com on 11 Mar 2010 at 2:13

GoogleCodeExporter commented 8 years ago
In that case, you can make use of rowCssClassExpression. This will avoid having
duplicated id's if you are displaying two grids in the same page.

Original comment by qiang.xue on 11 Mar 2010 at 2:50