jQWidgets Forums

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts

  • ysut
    Participant

    Any luck with this issue? Seem I am facing the same problem here. Please help and thanks

    in reply to: loadComplete does not fire. loadComplete does not fire. #73042

    ysut
    Participant

    Hi Peter

    Thanks for the response. The problem is I don’t get any error in loadError. I am sure the URL is OK, since I tried manually, it’s work. It’s return in XML format. Here’s the code.

    The scenario is I have a grid and want user can do inline editing. When he/she type the product code (column: kd_barang), then will retrieve the data via URL, and put the product name at the second column of grid (column: nm_barang).

    Am I missed something? Thanks in advance.

    $("#jqxgridPODetail").on('cellendedit', function (event) {
                    var args = event.args;
                    var columnDataField = args.datafield;
                    var rowIndex = args.rowindex;
                    var cellValue = args.value;
                    var oldValue = args.oldvalue;
    
                    if (columnDataField == "kd_barang") {
                        var source = {
                            datatype: "xml",
                            datafields: [
                                { name: 'kd_barang' },
                                { name: 'nm_barang' },
                                { name: 'hrg_jual' },
                                { name: 'hrg_beli' },
                                { name: 'flag_active' },
                                { name: 'flag_checkstock' }
                            ],
                            record: 'content',
                            url: 'ysoftws.asmx/GetBarangDetail?sKdBarang=' + cellValue
                        };
    
                        var dataAdapter = new $.jqx.dataAdapter(source, {
                             loadComplete: function () {
                                 var records = dataAdapter.records;
                                 var length = records.length;
                                 var rows = $('#jqxgridPODetail').jqxGrid('getrows');
                                 var rownumber = rows.length - 1;
                                
                                 if (length = 0) {
                                     if (record.flag_active != "T") {
                                         alert("The code is Not Active. Try again!");
                                         $("#jqxgridPODetail").jqxGrid('setcellvalue', rownumber, "kd_barang", "");
                                         $("#jqxgridPODetail").jqxGrid('setcellvalue', rownumber, "nm_barang", "");
                                     }
                                     else {
                                         // put the product name and unit price
                                         $("#jqxgridPODetail").jqxGrid('setcellvalue', rownumber, "nm_barang", record.nm_barang);
                                         $("#jqxgridPODetail").jqxGrid('setcellvalue', rownumber, "qty", 1);
                                         $("#jqxgridPODetail").jqxGrid('setcellvalue', rownumber, "hrg_satuan", record.hrg_beli);
                                     }
                                 }
                                 else {
                                     alert("Product code not found !!!");
                                     $("#jqxgridPODetail").jqxGrid('setcellvalue', rownumber, "kd_barang", "");
                                 }
                             },
                             loadError: function (jqXHR, status, error) {
                                 alert(error);
                             },
                             beforeLoadComplete: function (records) {
                             }
                         });
                    }
    in reply to: loadComplete does not fire. loadComplete does not fire. #73022

    ysut
    Participant

    Hi nja

    Did you solve your question, since I am facing a similar case like you.
    Please share.

    Thanks in advance

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