Display line number in row?
Is it possible to display the respective line number in each row?
Hey mopinsk, I have same requirement. Have u got solution for this?
No, unfortunately I don't have a solution for this.
Ok, Thanks for the response
Hey mopinsk, have you found a solution yet?
I didn't look into this further, so no, I don't have a solution.
Hi, Have you got solution for this problem?
Hi This is my code when setting config of smart table in typescript use it => valuePrepareFunction(row) row object has "index" property use like below particular code you will see it
> columns: {
> idx: {
> title : "INDEX",
> type : "text",
> filter:false,
> valuePrepareFunction:(row) =>{
> // console.log(row);
> // console.log(row.index);
> return `${row.index}`;
> }
> },
Hi This is my code when setting config of smart table in typescript use it => valuePrepareFunction(row) row object has "index" property use like below particular code you will see it
> columns: { > idx: { > title : "INDEX", > type : "text", > filter:false, > valuePrepareFunction:(row) =>{ > // console.log(row); > // console.log(row.index); > return `${row.index}`; > } > },
it not work for me
row.index is only good for first page see a working solution
export interface IPaging { page:number; perPage:number; }
valuePrepareFunction : (value,row,cell)=>{ const paging:IPaging = this.source.getPaging(); const ret = (paging.page-1) * paging.perPage + cell.row.index+1; return ret; }
Hi This is my code when setting config of smart table in typescript use it => valuePrepareFunction(row) row object has "index" property use like below particular code you will see it
> columns: { > idx: { > title : "INDEX", > type : "text", > filter:false, > valuePrepareFunction:(row) =>{ > // console.log(row); > // console.log(row.index); > return `${row.index}`; > } > },
The first parameter of valuePrepareFunction contains the value of the cell. Hence, it doesn't contain any index.
function* generateNumbers () {
let index = 1;
while (true) {
yield index++;
}
}
const tableId = generateNumbers();
columns: {
id: {
title: 'ID',
type: 'number',
valuePrepareFunction: () => {
return tableId.next().value;
},
},
}
Hi This is my code when setting config of smart table in typescript use it => valuePrepareFunction(row) row object has "index" property use like below particular code you will see it
> columns: { > idx: { > title : "INDEX", > type : "text", > filter:false, > valuePrepareFunction:(row) =>{ > // console.log(row); > // console.log(row.index); > return `${row.index}`; > } > },it not work for me
if you have paging , the second page will show incorrect value
This work fine for me...
columns: {
index: {
title: "Item",
type: "text",
width: "100px",
valuePrepareFunction: (value, row, cell) => {
return cell.row.index + 1;
},
},
}
