jQuery UI Widgets Forums Grid jqxGrid 'deleterow' error

This topic contains 9 replies, has 3 voices, and was last updated by  JenkeNg 4 years, 8 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • jqxGrid 'deleterow' error #106449

    JenkeNg
    Participant

    jqxGrid reported an error “Uncaught TypeError: Cannot read property ‘value’ of undefined” when executing ‘deleterow’ method. I tried to write a fixed ID and this method works fine. I posted my code, please help me check where there is a problem:
    1、
    var rowindexes = $(‘#nonMachinePriceGrid’).jqxGrid(‘getselectedrowindexes’);
    var jsonParams = new Object();
    jsonParams.ids = (function () {
    var array = new Array();
    for (var i in rowindexes) {
    var rowId = $(‘#nonMachinePriceGrid’).jqxGrid(‘getrowid’, rowindexes[i]);
    array.push(rowId);
    }
    return array;
    }());
    method.delNonMachinePrice(jsonParams);
    2、
    delNonMachinePrice: function (jsonParams) {
    $.ajax({
    url: ‘../../productPrice/delNonMachinePrice.do’,
    type: ‘delete’,
    data: {‘jsonParams’: JSON.stringify(jsonParams)},
    dataType: ‘json’,
    async: false,
    success: function (result) {
    layer.msg(‘success’, {icon: 1, time: 1500});
    var ids = jsonParams[‘ids’];
    $(‘#nonMachinePriceGrid’).jqxGrid(‘deleterow’,ids);
    },
    error: function () {
    layer.msg(‘service error’, {icon: 2, time: 1500});
    }
    })
    }

    jqxGrid 'deleterow' error #106450

    JenkeNg
    Participant

    If you enter a fixed parameter, such as $(‘#gridName’).jqxGrid(‘deleterow’, 222); or $(‘#gridName’).jqxGrid(‘deleterow’,[‘222′,’223’]); It can be executed normally, I tried and confirmed this.

    jqxGrid 'deleterow' error #106460

    Todor
    Participant

    Hello JenkeNg,

    Please share a jsfiddle/codepen example demonstrating the reported issue, so that we may determine what causes it.

    Also you could check ‘ids’ array if everything is fine with it. If it is working with hard coded array, most probably the issue comes form the ‘ids’ array.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com

    jqxGrid 'deleterow' error #106467

    JenkeNg
    Participant

    I wrote an example, but the strange thing is that I can’t reproduce the problem. The only difference is that my actual development uses an ajax request, and the example is to create a temporary data.

    The example I wrote is working fine and it’s really a headache.
    2、
    Still can only describe my problem:
    1)
    My code:

    delNonMachinePrice: function (jsonParams) {
    var ids = jsonParams[‘ids’];
    console.log(ids);
    $.ajax({
    url: ‘../../productPrice/delNonMachinePrice.do’,
    type: ‘delete’,
    data: {‘jsonParams’: JSON.stringify(jsonParams)},
    dataType: ‘json’,
    async: false,
    success: function (result) {
    layer.msg(‘delete success’, {icon: 1, time: 1500});

    },
    error: function () {
    layer.msg(‘service error’, {icon: 2, time: 1500});
    }
    });
    $(‘#nonMachinePriceGrid’).jqxGrid(‘deleterow’, ids);
    }
    Console output:
    [“144”]
    jqxgrid.js:13765 Uncaught TypeError: Cannot read property ‘value’ of undefined
    at b.jqx.dataview.loadflatrecords (VM566 jqxgrid.js:13765)
    at b.jqx.dataview.updateview (VM566 jqxgrid.js:13815)
    at b.jqx.dataview.reload (VM566 jqxgrid.js:13712)
    at b.jqx.dataview.sortby (VM571 jqxgrid.sort.js:7)
    at f (VM566 jqxgrid.js:9255)
    at b.<computed>.deleterow (VM566 jqxgrid.js:9276)
    at Object.a.jqx.invoke (jqxcore.js:5628)
    at Object.a.jqx.jqxWidgetProxy (jqxcore.js:5968)
    at HTMLDivElement.<anonymous> (jqxcore.js:6313)
    at Function.each (VM546 jquery-1.8.0.min.js:2)
    loadflatrecords @ jqxgrid.js:13765
    updateview @ jqxgrid.js:13815
    reload @ jqxgrid.js:13712
    sortby @ jqxgrid.sort.js:7
    f @ jqxgrid.js:9255
    deleterow @ jqxgrid.js:9276
    a.jqx.invoke @ jqxcore.js:5628
    a.jqx.jqxWidgetProxy @ jqxcore.js:5968
    (anonymous) @ jqxcore.js:6313
    each @ jquery-1.8.0.min.js:2
    each @ jquery-1.8.0.min.js:2
    a.fn.<computed> @ jqxcore.js:6312
    delNonMachinePrice @ product_price.html:1199
    (anonymous) @ product_price.html:687
    (anonymous) @ layer.js:2
    dispatch @ jquery-1.8.0.min.js:2
    h @ jquery-1.8.0.min.js:2
    jqxgrid.js:13765 Uncaught TypeError: Cannot read property ‘value’ of undefined
    at b.jqx.dataview.loadflatrecords (VM566 jqxgrid.js:13765)
    at b.jqx.dataview.updateview (VM566 jqxgrid.js:13815)
    at b.<computed>._calculatevirtualheight (VM566 jqxgrid.js:4159)
    at b.<computed>.rendergridcontent (VM566 jqxgrid.js:4874)
    at b.<computed>._render (VM566 jqxgrid.js:4704)
    at VM566 jqxgrid.js:9226

    It’s incredible! !

    jqxGrid 'deleterow' error #106468

    JenkeNg
    Participant

    jqxGrid 'deleterow' error #106469

    JenkeNg
    Participant
    jqxGrid 'deleterow' error #106470

    JenkeNg
    Participant

    I just found out that the example I gave will be strange if it is deleted in batches.

    jqxGrid 'deleterow' error #106720

    JenkeNg
    Participant

    Why don’t you answer my question? This question has not been solved. I gave an example, and this is a very strange phenomenon when deleting. The data is deleted, but the line is still

    jqxGrid 'deleterow' error #106734

    Peter Stoev
    Keymaster

    Hi,

    In virtual mode, the data that is displayed in the Grid is the data returned by the custom code in the rendergridrows function. Deleting a row in Virtual Mode with the Grid API only calls the custom source object deleterow function and re-renders the Grid.

    Best Regards,
    Peter

    jQWidgets Team
    https://www.jqwidgets.com

    jqxGrid 'deleterow' error #106828

    JenkeNg
    Participant

    Ok, thank you for your answer. My current solution to this problem is to use $(gridname).jqxGrid(‘updatebounddata’); after retrieving the data rendering page instead of calling the deleterow method, I don’t know if this is the best. method.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.