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
delData not posting to server in v. 4.1.2
23/08/2011
21:59
Avatar
cjordan
USA
Member
Members
Forum Posts: 11
Member Since:
19/08/2011
sp_UserOfflineSmall Offline

I originally posted about this as a reply to a similar bug concerning editData, but thought that I should perhaps make this its own thread since it's really a different issue.

Here's my code:

$('#tblMapGrid').jqGrid({
    colNames: ['COL1','COL2','COL3','COL4','COL5','COL6ID','COL6','COL7ID','COL7'],
    colModel: [
        {name:'COL1',index:'COL1',hidden:true,editable:true},
        {name:'COL2',index:'COL2',hidden:true,editable:true},
        {name:'COL3',index:'COL3',hidden:true,editable:true},
        {name:'COL4',index:'COL4',width:85,sortable:false,editable:true},
        {name:'COL5',index:'COL5',width:175,sortable:false,editable:true},
        {name:'COL6ID',index:'COL6ID',hidden:true,editable:true},
        {name:'COL6',index:'COL6',width:70,align:'center',sortable:false,editable:true},
        {name:'COL7ID',index:'COL7ID',hidden:true,editable:true},
        {name:'COL7',index:'COL7',width:57,align:'center',sortable:false,editable:true}
    ],
    jsonReader: {
        repeatitems:true,
        root: 'rows',
        cell: 'cell',
        id: 'id'
    },
    pager:'#MapGridNav',
    onSelectRow: function(id){
        if(id && id !== local.lastSelectedRow){
            $('#tblMapGrid').jqGrid('restoreRow',local.lastSelectedRow);
            $('#tblMapGrid').jqGrid('editRow',id,true);
            local.lastSelectedRow = id;
        }
    },
    editurl: 'ajaxproxy.cfm?method=updateTable'
}).navGrid('#MapGridNav',
    {// start navigator options
        add:true,
        del:true,
        edit:false,
        refresh:false,
        search:false,
        addfunc: function(){
            $('#tblMapGrid').jqGrid('editGridRow','new',{
                top: 150,
                left: 400,
                addCaption: 'Add New GL Mapping',
                bSubmit: 'Save',
                editData:{
                    YARDIDB: $('#GLMapYardiDB').val(),
                    COA: $('#GLMapCOA').val(),
                    MAPPING: $('#GLMapMapping').val()
                }
            });
        },
        delfunc: function(rowid){
            $('#tblMapGrid').jqGrid('delGridRow',rowid,{
                top: 175,
                left: 400,
                caption: 'Delete Existing GL Mapping',
                msg: '<br />&nbsp;Are you sure you wish to delete the<br />&nbsp;selected GL Mapping?',
                bSubmit: 'Yes',
                bCancel: 'No',
                delData:{
                    COL6ID: $(rowid+'_COL6ID').val(),
                    COL7ID: $(rowid+'_COL7ID').val()
                }
            });
        }
    }// end navigator options
);

I've shortened this up quite a bit for the sake of discussion. In reality, where I've got two ID fields (COL6ID and COL7ID) I've actually got 13 of those. This is because my grid is showing data that is aggregated, so each row in the grid represents 13 rows in my DB table. So, in order to delete a row, I need all of the unique IDs for each piece of data in my table. Thus, the ID for col6 preceeds the value found in col6. Hopefully, that makes sense.

Anyway, in the above code example the addfunc section works just great. After finding out that 4.1.2 had a bug in regards to editData, I patched it and it's working fine.

However, the delfunc section just below that is failing miserably, and with the same symptoms that my pre-patched version of jqGrid was exhibiting. Essentially, the delData object is not getting appended to the post data.

I have tried looking in the code where delData is apparently supposed to be getting appended (somewhere in the below code I think)              

$("#dData","#"+dtbl+"_2").click(function(e){
                    var ret=[true,""]; onCS = {};
                    var postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,…
                    if( $.isFunction( rp_ge[$t.p.id].onclickSubmit ) ) { onCS = rp_ge[$t.p.id].onclickSubmit(rp_ge[$t.p.id], postdata) || {}; }
                    if( $.isFunction( rp_ge[$t.p.id].beforeSubmit ) ) { ret = rp_ge[$t.p.id].beforeSubmit(postdata); }
                    if(ret[0] && !rp_ge[$t.p.id].processing) {
                        rp_ge[$t.p.id].processing = true;
                        $(this).addClass('ui-state-active');
                        opers = $t.p.prmNames;
                        postd = $.extend({},rp_ge[$t.p.id].delData, onCS);
                        oper = opers.oper;
                        postd[oper] = opers.deloper;
                        idname = opers.id;
                        postd[idname] = postdata;

… but nothing is jumping out at me as an obvious bug. I'm not very familiar with the jqGrid code itself, so I'm not sure that I'd be able to see the bug in the first place.

Anyway, is anyone else having this problem? It's really getting in my way of completing my project. I hope that some one on this board can help. I've searched around both this forum, Stackoverflow, and the Net in general, but cannot find any mention of this issue. Is it just me?

24/08/2011
00:23
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

I think this is not a bug.

The simple test is to put in delData a static values and see if they are posted, something like this

delData:{

    COL6ID: 12345,
    COL7ID: 67890
}

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.

24/08/2011
00:38
Avatar
cjordan
USA
Member
Members
Forum Posts: 11
Member Since:
19/08/2011
sp_UserOfflineSmall Offline

Thanks for the response, Tony.

I tried what you said, and indeed if I set the delData to static values, they're passed just fine.

So,

delData:{
    COL6ID: 1234,
    COL7ID: 5678
}

works but,

delData{
    COL6ID: $('#someID').val(),
    COL7ID: $('#someID').val()
}

does not work.

I still see this as some kind of bug. This very same technique worked just fine in my addfunc method just above it:

addfunc: function(){
            $('#tblMapGrid').jqGrid('editGridRow','new',{
                top: 150,
                left: 400,
                addCaption: 'Add New GL Mapping',
                bSubmit: 'Save',
                editData:{
                    YARDIDB: $('#GLMapYardiDB').val(),
                    COA: $('#GLMapCOA').val(),
                    MAPPING: $('#GLMapMapping').val()
                }
            });
        },

You can see that I'm doing almost the same thing with editData. The only real difference is that the data I'm getting here is not on any particular grid row, but rather just on the page itself.

Passing static values does me no good. I need to pass the values that are on the row the user is trying to delete. Due to my unique set of circumstances, I'm showing aggregate data each row on the jqGrid actually is comprised of upto 13 rows of data from my database table. So, the single "row id" that gets automattically passed as part of delGridRow() is meaningless to me.

Any ideas why it might be behaving this way?

Thanks for your help. Laugh

24/08/2011
00:45
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

It seems to me that you should concern not on the "grid delData bug", but rather on what are the dynamic values you ask when you lunch deleting a grid row.

Agian the simple test is try to see if these values exists during this call.

By example you can get the dynamic values from edit in order to see that everthing work ok.

Happy debugging. Wink

Kind Regsrds

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.

24/08/2011
00:50
Avatar
cjordan
USA
Member
Members
Forum Posts: 11
Member Since:
19/08/2011
sp_UserOfflineSmall Offline

Okay, this was certainly a bug (in MY code)... sorry for bothering you. But your reply DID help me to see my own stupidity.

My original (buggy) code was:

    delData:{
        COL6ID: $(rowid+'_COL6ID').val(),
        COL7ID: $(rowid+'_COL7ID').val()
    }

But SHOULD have been:

    delData:{
        COL6ID: $('#' + rowid + '_COL6ID').val(),
        COL7ID: $('#' + rowid + '_COL7ID').val()
    }

Notice the first example was missing the opening hash character needed by jQuery to fetch by ID. Bah! #codingFail #facePalm Frown

Thanks for helping me see my issue, and thanks so much for jqGrid!! Laugh

24/08/2011
00:51
Avatar
cjordan
USA
Member
Members
Forum Posts: 11
Member Since:
19/08/2011
sp_UserOfflineSmall Offline

tony said:

Hello,

It seems to me that you should concern not on the "grid delData bug", but rather on what are the dynamic values you ask when you lunch deleting a grid row.

Agian the simple test is try to see if these values exists during this call.

By example you can get the dynamic values from edit in order to see that everthing work ok.

Happy debugging. Wink

Kind Regsrds


Yep, I saw this and was writing my big reply below while you were getting back to me again. D'oh! Embarassed Thanks again!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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