Hi everyone,
I would like to create a column that will count each line of the result showed in a search view.
For example, line 1, line 2, line 3, etc. as many lines showed was result. I cant use autoincrement field, because the results will change and I need to "count" each line.
Just like excel does with line numbers.
Does anyone know can I do it?
Thanks!
Thanks for trying, but it did not work.
Not without custom Javascript I'd think - add the column after render and loop through each row to add the text for each row.
Air code here:
$(document).on('knack-view-render, view_XXX', function(event, view, data) {
$('view_XXX table thead tr').append('<th>Line</th>); //add header column
$('view_XXX table tbody tr').append('<td class="line-count"> </td>'); // body row column
//Loop through each row and update the text
$.each($('view_XXX table tbody tr td.line-count'), function(index, obj) {
$(this).text('Line ' + index);
});
});
I have no idea if this will work as my JS skills are self-taught and a paid programmer would nail this quickly I'd think.