Datatable have num order column

I want to create a datatable with a column auto increse by number of records.
Example:
ID | Name
1 | Duy
2 | Duc
3 | Lin

I want ID column auto increase.
3 records → 1 2 3
5 records → 1 2 3 4 5

Thank you!

Hey @duynq2197, you can dynamically update your column config and you can control what kind of data goes in, so for example, you could push a column with an incrementing id: https://snippet.webix.com/hkstgfem. Please note, that you have to call the refreshColumns method each time for the update to become visible.

THank you. But that’s not my mean. I get data from API so my datatable display ID column by ID of item i storage in MySQL. So when i do some filter, ID column display wrong. For example:

Normal:
ID | Name | Age
1 | Duy | 12
2 | Dung | 7
3 | Lin | 7

After filer to find Age = 7
ID | Name | Age
2 | Dung | 7
3 | Lin | 7

My wish: [ID colum]
ID | Name | Age
1 | Dung | 7
2 | Lin | 7

instead of ID try to add a column with this template

function(obj, common, value, column, index) {
        return index + 1;
}

Thanks. Now i have a new problem.
Because i load data dynamic, so sort from client is not working. Is there anyway to fix that ?

I don’t think it is possible, as to sort data on client side properly, you have to load data completely.

thank you. I find a way to resolve this. I have use
function(obj, common, value, column, index) {
return index + 1;
}
as normal for the column i want, but i set this function in template property.

It’s will be like:
{view:’…’, …, template: (a,b,c,d,index){return index+1}}

Love u, webix