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
'selrow' parameter invalid for Cell Editing
07/08/2012
04:29
Avatar
nisrak
Member
Members
Forum Posts: 4
Member Since:
21/07/2012
sp_UserOfflineSmall Offline

Hello,

I have a jqGrid set up with cell editing and everything is working great! I am using custom editrules that perform ajax calls to do custom validation.  To perform this validation, I am using the following command to get id of the row that is being edited:

var rowId = jQuery("#capacity_list").getGridParam('selrow');

The problem I am having is that when I edit a cell and then click on another row (thus causing the cell to save), the validation gets the rowId of the newly clicked on cell because the editrules function is firing after the selected row changes.  Is there another way to get rowId that avoids this problem?

Below is an example of my code:

jQuery("#capacity_list").jqGrid({

...

colModel: [

    {name:'currentCapacity', width:50, editable:true, editrules:{number:true, "custom":true, "custom_func":validateCapExpand}},

...

 function validateCapExpand(data, value) {
        var result = [true, ''];

        var rowId = jQuery("#capacity_list").getGridParam('selrow');
        if(rowId) {
            jQuery.ajax({
                async: false,
                url: 'asset/validateCapExpand',
                data: { currentCapacity: data, assetId: ${assetInstance.id}, rowId: rowId },
                dataType: 'json',
                contentType: 'application/json; charset=utf-8',
                success: function(data) {
                    if(data.retVal) {
                        result = [true, '']
                    } else {
                        result= [false, ' is greater than max expandable'];
                    }
                },
                error: function () { alert('Error trying to validate'); }
            });
        }
        return result;
    }

Thanks for any help!

- Nisrak

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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