Error "this.node is not a function" when using editor with key

Error "this.node is not a function" when using editor with key

hendrikwjyhendrikwjy Posts: 8Questions: 1Answers: 0

Hi,

I use editor with key, but when i try to type something in the field, it show error like this.
It doesnt happen when i use old version.

https://demo.longjiwo.com/transaksi/adjustment/create
User : test
Pass : test

Thanks

This question has an accepted answers - jump to answer

Answers

  • DonaldmaxDonaldmax Posts: 1Questions: 0Answers: 0

    facing same issue on latest version any one help please

  • allanallan Posts: 61,710Questions: 1Answers: 10,102 Site admin

    Hi,

    Sorry we missed your post @hendrikwjy. Are you able to show me your unobfuscated code? @Donaldmax - likewise, could you show me the code you are using please?

    Thanks,
    Allan

  • hendrikwjyhendrikwjy Posts: 8Questions: 1Answers: 0

    Hi,

    Thanks for your reply, here is the code
    The variables are oEditor for the Editor and oTable for the table.
    You can revisit the url for the complete code, because the code is unobfuscated now.

    Thanks

    var oTable=null;
    var oEditor=null;
    var modifier=null;
    var curKolom;
    var curRow;
    var curData;
    var arrkolom = ["pilih", "urut", "kode", "nama", "qty", "satuan", "harga", "subtotal", ];
    var arrkolomfocus = [$.inArray( "kode", arrkolom), $.inArray( "qty", arrkolom)];
    var cellidx;
    
    
    
    
        var jssDataTable = function () {
    
            if (!show) {
                oEditor = new $.fn.dataTable.Editor({
                    table: "#dtdetail",
                    idSrc:  'urut',
                    fields: [ {
                        name: "urut"
                    }, {
                        name: "kode",
                    }, {
                        name: "nama",
                        type:  "readonly",
                    }, {
                        name: "qty",
                        attr: {
                        }
                    }, {
                        name: "satuan",
                        type:  "readonly",
                    }, {
                        name: "harga",
                        type:  "readonly",
                    }, {
                        name: "subtotal",
                        type:  "readonly",
                    },
                    ],
                });
    
                oEditor
                    .on( 'preOpen', function ( e, mode, action ) {
                        var pilih = $("#gudang1").select2('data');
                        if ($.isEmptyObject(pilih)) {
                            var content = {};
                            content.message = "<strong>Pilih Gudang Terlebih Dulu!</strong>";
                            content.title = 'Data Transaksi';
                            content.icon = 'icon fa fa-times-circle ' ;
                            jssNotify(content);
                            return false;
                        }
                    } )
                    .on( 'open', function ( e, mode, action ) {
                        modifier = oEditor.modifier();
                    } )
                    .on( 'preSubmit', function ( e, o, action ) {
                    } )
                    .on( 'preClose', function ( e ) {
                    } )
                    .on( 'close', function () {
                        var retval = true;
                        curData = oTable.row(modifier.row).data();
                        var kode = curData.kode;
                        switch(curKolom) {
                            case "kode":
                                if (curData.kode.substring(0,1) == ".") {
                                    searchbrg = "";
                                    if (curData.kode.length > 1) {
                                        searchbrg = curData.kode.substring(1,curData.kode.length);
                                    }
                                    $('#mdlCariBarang').modal('show');
                                } else if (curData.kode.length > 0 ){
                                    CariBarang(kode,'kode',false);
                                }
    
                                break;
                            case "qty":
                                cellidx = {row:curRow, column:$.inArray( curKolom, arrkolom)};
                                if (!$.isNumeric(oTable.cell(cellidx).data())){
                                    var content = {};
    
                                    content.message = "<strong>Qty tidak valid!</strong>";
                                    content.title = 'Data Transaksi';
                                    content.icon = 'icon fa fa-times-circle ' ;
    
                                    jssNotify(content);
    
    
                                    retval = false;
                                    curData.qty = 0;
                                }
                                break;
                        }
    
                        curData.subtotal = jssHitungTotal(curData.qty, curData.harga,0, 0, 0, 0);
                        HitungTotal();
                        oTable.row(modifier.row).data(curData).draw();
    
                        if (!retval) {
                            setTimeout(function() {
                                oTable.cell(cellidx).focus();
                            }, 500);
                        }
                    } );
            }
    
    
            oTable = $('#dtdetail').DataTable({
                "language": {
                    "paginate": {
                      "first": "<<",
                      "previous": "<",
                      "next":">",
                      "last":">>",
                    }
                },
                "ordering": false,
                select: {
                    style:    'os',
                    selector: 'td:first-child'
                },
                "dom": "<'row'<'col-sm-12'tr>>",
                "paging" : false,
                "responsive":true,
                "keys": {
                    columns: arrkolomfocus,
                    editor:  oEditor
                }, 
                "columns": [
                    { "orderable": false, "data": "null", defaultContent: '', className: 'select-checkbox', "width":"5%" },
                    { "orderable": false, "data": "urut", "name": "urut", "width":"5%" },
                    { "orderable": false, "data": "kode", "name": "kode",  "width":"10%"  },
                    { "orderable": false, "data": "nama", "name": "nama", "width":"30%" },
                    { "orderable": false, "data": "qty", "name": "qty",  "width":"10%", "className" : "m--align-right" ,
                    "render" : $.fn.dataTable.render.number( ',', '.', 0 )
                    },
                    { "orderable": false, "data": "satuan", "name": "satuan",  "width":"5%" },
                    { "orderable": false, "data": "harga", "name": "harga",  "width":"10%", "className" : "m--align-right", "visible": false ,
                    "render" : $.fn.dataTable.render.number( ',', '.', 0 )
                     },
                     { "orderable": false, "data": "subtotal", "name": "subtotal",  "width":"20%","className" : "m--align-right", "visible": false ,
                    "render" : $.fn.dataTable.render.number( ',', '.', 0 )
                     },
                    ],
                
            });
            
            oTable.on( 'key-focus', function ( e, datatable, cell, originalEvent ) {
                curKolom = arrkolom[cell.index().column];
                curRow = cell.index().row;
            } );
            
    
            
    
            
        
        };
        
    
    
  • allanallan Posts: 61,710Questions: 1Answers: 10,102 Site admin
    Answer ✓

    Thank you for that! i believe you are hitting a problem in FixedColumns that has relatively recently been resolved. Could you try loading in the nightly version of FixedColumns: https://datatables.net/download/nightly ?

    Thanks,
    Allan

  • hendrikwjyhendrikwjy Posts: 8Questions: 1Answers: 0

    Hi,

    Thank you @allan. This solve the problem

This discussion has been closed.