Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Bug in viewgridrow with spaces in column name?
09/02/2011
19:52
Avatar
Octavient
Member
Members
Forum Posts: 9
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

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>

09/02/2011
23:47
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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 

06/01/2012
23:22
Avatar
earachefl
Member
Members
Forum Posts: 10
Member Since:
04/01/2012
sp_UserOfflineSmall Offline

Oleg, I have to say that I consider this to be a design flaw. We shouldn't have to follow variable naming constraints for our titles. If spaces in the IDs that are created are a no-no, why not have jqgrid insert underscores when it creates the IDs?

07/01/2012
02:40
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Your problem is that you use tableToGrid plugin insted of the usage of jqGrid directly. If you need use titel having blanks you should use colNames option of jqGrid (or the same option of tableToGrid) instead of the usage of ids having blanks.

Best regards
Oleg 

10/01/2012
15:06
Avatar
earachefl
Member
Members
Forum Posts: 10
Member Since:
04/01/2012
sp_UserOfflineSmall Offline

I decided to hack viewGridRow() instead. I added this line:

nm = nm.replace(' ', '_');

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.
  

     

10/01/2012
16:10
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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 

07/02/2012
19:44
Avatar
earachefl
Member
Members
Forum Posts: 10
Member Since:
04/01/2012
sp_UserOfflineSmall Offline

Oleg, I'm not understanding how to use $.jgrid.jqID to accomplish this. Is this separate from the grid initialization? How is it supposed to be called? I've tried adding:

jQuery.jgrid.jqID(' ');

but this doesn't seem to have any affect.

Any help would be greatly appreciated.

07/02/2012
21:32
Avatar
earachefl
Member
Members
Forum Posts: 10
Member Since:
04/01/2012
sp_UserOfflineSmall Offline

Oleg, I just realized that you meant to modify the regex string inside jqID() to include spaces. That seems to do the trick.

08/02/2012
12:00
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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

$.extend($.jgrid, {
    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

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
44 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information