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
getGridParam('selrow') gives different results before and after sorting
20/08/2014
15:04
Avatar
Getfree
Member
Members
Forum Posts: 8
Member Since:
03/10/2012
sp_UserOfflineSmall Offline

The method call $('...').getGridParam('selrow') gives the sequential ID of the selected row if the grid is not sorted.

But after you sort by any column, it gives the primary key column of the seleced row (the one with {key: true} in the colModel).

Is there some configuration parameter or something to prevent this inconsistency?

I'm creating the grid from an HTML table using the function tableToGrid.

20/08/2014
16:58
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

 

If you use  key true the id shouldcome from that row.

Will be interesting from me if you put online example or post a code with some data.

 

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/08/2014
20:53
Avatar
Getfree
Member
Members
Forum Posts: 8
Member Since:
03/10/2012
sp_UserOfflineSmall Offline

I made a jsfiddle where you can reproduce the problem.

http://jsfiddle.net/wnL0z2mc/

21/08/2014
16:52
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

 

This is not a bug not in jqGrid itself, but it is a bug in the user provided function tableToGrid.

I recommend yo to get the data as array and create the grid from scratch, not using this method.

Note that I plan to remove this method from the build in the next release and put it in the custom methods.

 

The bug is between these lines of code

    // Add data
    var a;
    for (a = 0; a < data.length; a++) {
        var id = null;
        if (rowIds.length > 0) {
            id = rowIds[a];
            if (id && id.replace) {
                // We have to do this since the value of a checkbox
                // or radio button can be anything
                id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
            }
        }
        if (id === null) {
            id = a + 1;
        }
        jQuery(this).jqGrid("addRowData",id, data[a]);
    }

 

Comment this fragment and one step above change the setting to:

 

  jQuery(this).jqGrid(jQuery.extend({
        datatype: "local",

        data :  data,

        width: w,
        colNames: colNames,
        colModel: colModel,
        multiselect: selectMultiple
        //inputName: inputName,
        //inputValueCol: imputName != null ? "__selection__" : null
    }, options || {}));

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.

23/08/2014
01:57
Avatar
Getfree
Member
Members
Forum Posts: 8
Member Since:
03/10/2012
sp_UserOfflineSmall Offline

Nice fix.

Thanks.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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