vendredi 5 juillet 2019

In tabulator AJAX call(on CELLEDITED) and addRow() functionaliry cursor is always moving to the first row and first cell

In Tabulator in celledited() function, after ajax call always the cursor is moving to the first row first coulumn.

I have tried with available tabulator api, nothing is working. table.navigateNext() cell.getElement().focus();

table = new Tabulator("#example-table", {
            data:self.get('tableData'),
            selectable:1,
            height:"auto",
            columns:self.get('tableColumnData'),
            keybindings:true,

            cellEdited:function(cell){                  
                self.cellBlur(cell, row,value, self.get("testData"));
            },
        });        

   },
   cellBlur: function(cell, row, value, testData){
        self.send('execute',value,id,row); 
        //table.scrollToColumn(cell.getField(), "middle", false);
        //console.log("cell nav right1 "+cell.getField())
        //if(cell.getField() === "NAME"){
        //cell.nav().right();
        //self.get('table').navigateNext();
        //}

    },
    actions: {
     self.get('services').fetch(self.get('services').getModuleUrl('TEST'), 'controller/test', requestdto, 'POST').then(function (json) {
                    if (json !== null && json.data !== null) {
        execute: function (value, eventId, fieldName) {                                                                                     

                           self.get('table').updateOrAddRow(rowIndex,tempObj).then(function(row){
                                                                console.log("pring updateOrAddRow ....");
                                                                var cell = row.getCell("ACCNAME");
                                                                cell.getElement().focus();
                                                        })
                                                        .catch(function(error){
                                                        });
        }
        }
        },

enter image description here In the above image 1.once I enter STUDENT ID, cellEdited() function is calling, inside this by making AJAX call I am fetching the student name based on ID and populating the name -in the second column. 2.After I enter the tab the cursor is moving to the STUDENT ID column instead of STUDENT MARKS column. 3. In the second row once I enter the student id and the tab, the name is populating in the second column, if I give the next tab the cursor is moving to the first row first cell.

Not sure which part of the code is causing this issue, it might be due to onblur ajax call or addRow functionality.

Your suggestions are highly appreciated.




Aucun commentaire:

Enregistrer un commentaire