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
jqGrid('getGridParam', 'selRow') selects previous value
13/04/2010
15:38
Avatar
Seroczynski
The Netherlands
Member
Members
Forum Posts: 17
Member Since:
10/02/2010
sp_UserOfflineSmall Offline

Hey Tony,

I'm unsure wether this is adressed before, but a few search queries on the forum lead to nothing so I'll give it a shot by creating a new topic.

I'm using inline edit and have a custom safe function. But that all aside, when I simple alert() (triggered by onclick on jqGrid) the value that jqGrid('getGridParam', 'selRow') returns I always notice it's the id of the previous record. The first record I click after the page finished loading I get NULL as an result. This troubles me when I try to save my records.

If addition information is needed I'll post when asked. Thanks in advance.

14/04/2010
21:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Yes it will be good to post the code. Actually it depends where you call jqGrid('getGridParam', 'selrow').

Best Regards

Tony

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.

15/04/2010
12:31
Avatar
Seroczynski
The Netherlands
Member
Members
Forum Posts: 17
Member Since:
10/02/2010
sp_UserOfflineSmall Offline

My jqGrid script:

var editValue;

jQuery(document).ready(function(){
jQuery('#Tarieven-Ben').jqGrid({
hidegrid: false,
width: 1810,
height: 220,
xmlReader: {
root: 'Grid',
row: 'Rij',
page: 'Grid>Pagina',
total: 'Grid>Paginas',
records: 'Grid>Records',
repeatitems: false,
id: 'SOID'
},

url: 'functions/jqGridUpdate.php?bronXml=simonlies&queryId=0&sqlTeller=0&bronXml=simonlies',
datatype: 'xml',
mtype: 'GET',
colNames: ['ID', 'Volg', 'Provider'],
colModel: [
{name: 'SOID', index: 'SOID', width: 30, editable: false, editoptions:{readonly:false}},
{name: 'Volgnummer', index: 'Volgnummer', width: 40, editable: true, editoptions:{readonly:false}},
{name: 'Provider', index: 'Provider', width: 55, editable: true, editoptions:{readonly:false}},
],
onSelectRow: function(id){
if(id && id!==editValue){
jQuery('#Tarieven-Ben').jqGrid('editRow', id, true);
editValue=id;
}
},
pager: '#SO-Ben',
rowNum: 50,
rowList: [10, 20, 30],
sortname: 'SOID',
sortorder: '',
viewrecords: true,
caption: 'SimOnlyTarieven',
queryId: '0',
editurl: 'functions/formSave.php?bronXml=simonlies&spreadsheet=1&queryId=0&Naam=Tarieven-Ben'
});

The identification of the grid:

<table id='Tarieven-Ben' class='jqGrid' onclick='jQuery.jqGridChange("Tarieven-Ben")'></table>

Note the onclick event. Now this is what's behind that call:

    jQuery.jqGridChange = function(grid){
        var selected = jQuery("#" + grid).jqGrid('getGridParam', 'selrow');        
        if(jQuery.inArray(selected, recordsAangepast) == -1){
            recordsAangepast[recordsTeller] = selected;
            recordsTeller++;
        }
    };   

Hope this helps.

16/04/2010
18:42
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Right now I see. humm - Can not look at the code right now, but we bind a click to the table too.

Try this:

jQuery.jqGridChange = function(grid){

...

return false;

}

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.

19/04/2010
11:47
Avatar
Seroczynski
The Netherlands
Member
Members
Forum Posts: 17
Member Since:
10/02/2010
sp_UserOfflineSmall Offline

Hey Tony, thanks for your reply.

Unfortunately it changed nothing. I'm still unable to fix this issue.

19/04/2010
14:00
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello

The problem is that your onclick fire first and then onSelectRow which selects the value.

You should maybe not use onclick event for the table, but rather to use the onselectRow to do this.

Regards

Tony

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:
56 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