Forum
I'm using the tableToGrid feature, along with the viewGridRow feature. When the viewGridRow method is called, the dialog displays correctly. But when paging through records using the Pager Buttons, OR when you close the dialog and execute the viewGridRow method on another record, the values for all columns whose names have a space (" ") in them do not get updated. They keep the value that was placed there by the first viewGridRow execution. The values for all columns whose names do NOT have a space get updated as they should.
I've tried recreateForm:true (although this is a property of the editGridRow method, and not the viewGridRow method), and this did not resolve the issue. Also tried various, semi-random combinations of other settings.
Below is my code. Ideas?
tableToGrid("#mytable", height:'400',
ondblClickRow: function(rowid,iRow,iCol,e) {
jQuery("#mytable").viewGridRow(rowid, {closeOnEscape:true});
}
});
<table id="mytable">
<thead>
<tr class="header">
<th id="CustomerID">CustomerID</th>
<th id="Account ID">Account ID</th>
<th id="Customer">Customer</th>
<th id="System">System</th>
<th id="Make/Model">Make/Model</th>
<th id="Modality">Modality</th>
<th id="Last Login">Last Login</th>
<th id="Attachments">Attachments</th>
<th id="Alerts">Alerts</th>
<th id="Last Log Entry">Last Log Entry</th>
<th id="Last HE Level">Last HE Level</th>
<th id="HE Level Threshold">HE Level Threshold</th>
<th id="DBOD Threshold">DBOD Threshold</th>
<th id="HE Data Latency">HE Data Latency</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>32222222</td>
<td>ABC Company</td>
<td>Smith Warehouse Bay #1</td>
<td>Make/Model</td>
<td>MRI</td>
<td>Dec 20 2010 12:18PM by Frank Smith</td>
<td>0</td>
<td>0</td>
<td></td>
<td></td>
<td>60</td>
<td>0.35</td>
<td></td>
</tr>
...
</tbody>
</table>
23:47
10/08/2009
Hello,
I posted the answer on your question here. The usage of ids having blanks in <th> elements is the same as the usage of name and index properties of colModel with the blanks inside. It is wrong. Just remove the ids from <th> elements or use the values without blanks.
Best regards
Oleg
15:06
04/01/2012
I decided to hack viewGridRow() instead. I added this line:
in two places; first between these two lines in function createData():
setme = false;
nm = this.name;
second, between these two lines in function fillData():
nm = obj.p.colModel[i].name;
// hidden fields are included in the form
Now, all ids are created with underscores in the place of spaces and all is well.
16:10
10/08/2009
If you want modify the code you should better use $.jgrid.jqID instead of replacement of blanks to undescores. The function $.jgrid.jqID are used in the most places of jqGrid code, but still not everywhere. The problem it very easy. It one have meta-characters as the part of id and one want to use the id as a part of the jQuery selector one have to escape the characters. The method $.jgrid.jqID do exactly the job.
Regards
Oleg
12:00
10/08/2009
Yes, it's what I mean. Pobably I expressed me not clear enough before. In general one can excape or use a numerical code of any ISO 10646 character (see here) used in the selector.
You can use code like
jqID: function (sid) {
return String(sid).replace(/[!"#$%&'()*+, .\\/:;<=>?@\\[\\\\\\]\\^`{|}~]/g,"\\\\$&");
}
});
to change jqID without modification of the source code of jqGrid.
I don't recommend you use ids which includes blanks inside, but sometimes one have no control on the data which produce the foreign server code. So I personally find good to extend the code of jqID to include blank in the list of characters excaped by jqID.
@Tony: what do you think about?
Best regards
Oleg
Most Users Ever Online: 715
Currently Online:
54 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