Tabulator: deleteRow & getRow - Getting Error - No matching row found: 1

Created on 14 Nov 2017  路  4Comments  路  Source: olifolkerd/tabulator

Hi oli

$("#example-table").tabulator("getRow", 1);       - Find Error - No matching row found: 1
$("#example-table").tabulator("deleteRow", 1);       - Delete Error - No matching row found: 1

while addRow and setData works

what seems to be the issue ?

Question - Ask On Stack Overflow

Most helpful comment

You need to make sure that you have a column in your table containing unique values that correspond to the index of the row you are trying to get or delete. By default, tabulator will use the column with field: "id" as the index value however you can change this default behaviour when initializing tabulator e.g.

$("#example-table").tabulator({
    index:"age", //set the index field to the "age" field.
});

If you don't want your index column to be visible e.g. if it just contains unique id numbers for each row then simply set visible: false in your column definition for this column.

If you are still struggling please post a copy of your table construct.

All 4 comments

You need to make sure that you have a column in your table containing unique values that correspond to the index of the row you are trying to get or delete. By default, tabulator will use the column with field: "id" as the index value however you can change this default behaviour when initializing tabulator e.g.

$("#example-table").tabulator({
    index:"age", //set the index field to the "age" field.
});

If you don't want your index column to be visible e.g. if it just contains unique id numbers for each row then simply set visible: false in your column definition for this column.

If you are still struggling please post a copy of your table construct.

you are right @tomheaps its due to the index not set. Working now

Aren't name "index" supposed to be the row index from 1,2,3, etc..
I feel like its misleading.

A unique value is required for the index because otherwise the index number of the row would change every time the table was manipulated e.g. by sorting or filtering.

Hey @mohanen,

@tomheaps is bang on there. the index is a uniquely identifiable value for a row that does not change, because you can sort the data in Tabulator, basing the index on this would result in a value that changes.

In one of the upcomming releases i will be adding a lookup based on the position of the row in the table as well.

Cheers

Oli

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sphynx79 picture sphynx79  路  3Comments

cemmons picture cemmons  路  3Comments

aballeras01 picture aballeras01  路  3Comments

Honiah picture Honiah  路  3Comments

KES777 picture KES777  路  3Comments