Serial Number - Automatic Issue
Serial Number - Automatic Issue
I'm using datatable with static data for 2,500 rows. The table is working perfectly without any issues. I have put the serial number column as 1st column and added the serial number manually from the beginning.
However now i need to insert a row often in the middle or delete a column anywhere where i re-edit the whole serial numbers again since added manually.
Is it possible to override the serial number column as deletion of each row of serial number column would take more time and add a new one would take more time
How to auto-populate the serial number by overbidding the content on the 1st cell i.e ignoring manually added number and replace with auto-population so that i don't need to worry about insert/delete of any rows?
Thanks
This question has accepted answers - jump to:
Answers
How are you adding the serial number?
Is it client side or server side?
Is it just an index or does it relate to the data somehow?
How are you using the serial number column?
If you are using a DB maybe add an auto increment column.
Please provide more details of what you are trying to do.
Kevin
Kevin,
all are static data and client side HTML with datatables javascript file alone
<th>s.no</th>
...
...
<td>1</td>
..
<td>2</td>
....
<thead>
<tr>
<th>S.No</th>
<th>Title</th>
<th>Option</th>
</tr>
</thead>
<tbody>
<tr>
<td> <center> 1 </center></td>
<td> <center> Basic Knowledge</center> </td>
...
</tr>
<tr>
<td> <center> 2 </center></td>
<td> <center> Mechanical Knowledge</center> </td>
...
</tr>
....
....
</tbody>
</table>
Thanks
How are you using the serial number? Is it an index for sorting?
Maybe this index example will help. Sorry for all the questions but I don't understand how you are using this column and what the requirements for updating it are.
Maybe you can post a link to your page or a test case showing what you have with a description of what you want.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Keven, yes it is index for sorting and display the total number of counts for the user...
example
1,2.3......
index example which you have shown is fine..However in that example, the numbers doesn't exist..In my case any number exist in 1st serial column which i need to remove and add the index automatically like in the example
I suspect the example will work with HTML data. Datatables will see the index number as the data for the column. Give it a try and if you have difficulties please post a link to a running test case showing the issue.
Kevin
Here is a very simple example showing inserting and deleting a row and the index updating:
http://live.datatables.net/senocipi/1/edit
When inserting you will need to decide the default index. In this case its -1 which places the row at the top. You may need to adjust the example to meet your specific requirements.
Kevin
The above example is super......Thanks a lot