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
dataInit can be called with number as parameter
Tags: dataInit
03/04/2012
22:37
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

I exanined strange problem where dataInit was called multiple times: one time with Number as parameter like 0 (???) and the second time with DOM element as parameter. Because the code like $(0).datepicker() produce no exception typical code work correctly, but other kind of usage of input parameter can follow to error.

The reason of the strange behavior is in the line of setAttributes function from the grid.common.js module. The line

exclude = $.extend(exclude, exl);

will be used to merge exl array with the array holding some standard attributes

var exclude = ['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr'];

The problem is that $.extend don't work with arrays and in case of exl=['value'] for example (see the line) replace first elements instead of merging. In the example with ['value'] one get

['value','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr']

 instead of

['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr', 'value']

As the result the line $(elm).attr(key,value); will be used for dataInit and the function will be called with wrong parameter.

To fix the problem one should just replace the line

exclude = $.extend(exclude, exl);

to the line

$.merge(exclude, exl);

Best regards
Oleg

05/04/2012
13:05
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Thanks Oleg.

Fixed.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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