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_Related Related Topics sp_TopicIcon
setSelection case insensitive
19/09/2013
13:49
Avatar
DigitalForster
New Member
Members
Forum Posts: 2
Member Since:
19/09/2013
sp_UserOfflineSmall Offline

Hi Tony,

I'm using a unique id made by a custom encoding that means I can have two different records with the same charater but one in lower case and the other lower case.

I saw in the setSelection method that you use $t.rows.namedItem(String(selection)); but this will return the first name that macth with case insensitive.

Why don't use jQuery selector [id=?] or getElementsByName and loop to compare id attribute with the selection variable ?

Could you let me now if you can build a quick fix ?

Thks

19/09/2013
14:30
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi DigitalForster,

I suppose that you use Internet Explorer. It's remind me about the old answer. I made an official support request to Microsoft and Microsoft confirmed that rows.namedItem works incorrect with the case of ids. In one uses getElementById with id then it works correctly with the case of id in Internet Explorer.

The problem why it's difficult to use getElementById instead of rows.namedItem consist in misunderstanding of uniques of ids (rowids) by many users. Id must be unique over the whole HTML page. The problem is that many developers who uses jqGrid don't understand that. Some developers don't provide any id value at all. jqGrid have $.jgrid.randId() function, but it don't uses it during generating of rowids in case of undefined ids in the input. Instead of that it uses values 1,2,3… to be compatible with old versions of jqGrid. Another possible problem is in usage of more as one grids on the page. Even if the rowids are unique because there come from ids of one database table one can have still conflicts if one would use the same ids for more as one grid on the page. In the case one have to use idPrefix option for at least one grid, but not every edvelopers uses it. So jqGrid have to have code which should work event if rowids are unique inside of one grid only, but could be non-unique on the page. The method rows.namedItem helps here. Only the bug in Internet Explorer makes difficult to use ids which are not unique in case insensitive comparing.

As a workaround I recommend you to use another ids as which you use currently. I understand that it sounds hard, but it's clear that you have not the best choice of id currently. What I mean is just providing case insensitive ids for jqGrid and not changing of your backend. One can imagine many one-to-one conversions of original ids to the values which you can use in jqGrid. For example base64 coversion can be used.

Best regards
Oleg 

19/09/2013
15:59
Avatar
DigitalForster
New Member
Members
Forum Posts: 2
Member Since:
19/09/2013
sp_UserOfflineSmall Offline

Hi Oleg,

Ok, I will adapt my code.

Thks for the help,

Regards

DigitalFoster Wink

06/10/2013
12:58
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Instead I will replace the namedItem function. It causes a problems in iOS7 (which i think is a bug in the Safari)

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/12/2013
19:46
Avatar
Hdogger
Denver, CO
New Member
Members
Forum Posts: 2
Member Since:
04/10/2013
sp_UserOfflineSmall Offline

tony said:

Hello,

Instead I will replace the namedItem function. It causes a problems in iOS7 (which i think is a bug in the Safari)

Regards


I had the same problem in IOS 7 with jqGrid. Here is how I solved it. I added this function to the top of jquery.jqGrid.src.js

function CorrectNamedItem(collection, name) { var result = null; $.each(collection, function (index, elem) { if (elem.id === name || elem.name === name) { result = elem; return false; } }); return result; }


Then whenever jqGrid has a call like this:

var ind = ts.rows.namedItem(n);

I changed it into a call like this:

var ind = CorrectNamedItem(ts.rows, n);

Now IOS 7 jqGrid works fine.

I hope this change can be made into jqGrid permanently, since IOS 7 has poor behavior of the inbuilt function namedItem.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
33 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