Forum


05:52

13/11/2009

Hello,
I'm trying to use jqGrid on a complex existing table.
But, it seems the select row does not perform on input fields.
<table id="mytable">
<tr>
<th> header 1 </th>
<th> header 2 </th>
</tr>
<tbody>
<tr>
<td> data 1 </td>
<td><input type="text" value="data1"></td>
</tr>
<tr>
<td> data 1 </td>
<td>data 1</td>
</tr>
</tbody>
<table>
Using tableToGrid method, when I click on the input field, il does not select the row.
Is there something I don't see, or is it an issue ?
Thank's for your help.
Sloub
09:39

30/07/2009

I think its a deliberate feature... usually, you want clicks on inputs, selects and links to be handled by the object clicked on, and not by the grid, and thats what the click handler does.
There is a workaround, which is to supply your own beforeSelectRow handler, and do whatever you want there:
function myBeforeSelectRow(sid, e) {
var grid = $(e.target).closest("table.ui-jqgrid-btable");
var td = e.target;
if (td.tagName == 'A' || td.tagName == 'INPUT' || td.tagName == 'TEXTAREA' || td.tagName == 'OPTION' || td.tagName == 'SELECT' )
{
/* handle whichever special objects you want */
grid.jqGrid("setSelection", sid, true); // or whatever
return false
}
return true; // let the grid handle everything else the default way...
}
@Tony - it might be nice if the beforeSelectRow handler could tell the grid to ignore the type of the target element, eg by returning -1.
Mark
Most Users Ever Online: 715
Currently Online:
68 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66