fnGetData does not return the data in right order after column sorting in jquery DataTable?
fnGetData does not return the data in right order after column sorting in jquery DataTable?
i am using jquery dataTable for displaying customer records. First time i go to customer page,i have 20 customer records in dataTable sorted by
customerId column( so they are diplayed starting from 20 to 1 where 20 is the id of 20th customer and 1 is the id of first customer) in desc
order. 20th customer is shown at top in dataTable.
now if do below in my javascript code
[code]
var customerTable=$('#customer').dataTable();// where customer is the html div associated with dataTable
var custData = customerTable.fnGetData(18)// it gives me data of 19 row in dataTable( as dataTable index starts from 0)
// so i get the data of customer having customer id=19
[/code]
Perfectly fine till here.
Now i click the sorting icon on customerId column . So after sorting customer with id as 1 is displayed on top in dataTable and customer with id as 20
will be displayed at bottom. Now i do the my javascript opration again
[code]
var customerTable=$('#customer').dataTable();
var custData = customerTable.fnGetData(18)
// it should give me data for customer id=2 Right? but still i am getting the old data i.e customer Data having id=19.
[/code]
i am not getting why i am not getting the right data after sorting? how should i get the correct data with row id after dataTable
sorting?
customerId column( so they are diplayed starting from 20 to 1 where 20 is the id of 20th customer and 1 is the id of first customer) in desc
order. 20th customer is shown at top in dataTable.
now if do below in my javascript code
[code]
var customerTable=$('#customer').dataTable();// where customer is the html div associated with dataTable
var custData = customerTable.fnGetData(18)// it gives me data of 19 row in dataTable( as dataTable index starts from 0)
// so i get the data of customer having customer id=19
[/code]
Perfectly fine till here.
Now i click the sorting icon on customerId column . So after sorting customer with id as 1 is displayed on top in dataTable and customer with id as 20
will be displayed at bottom. Now i do the my javascript opration again
[code]
var customerTable=$('#customer').dataTable();
var custData = customerTable.fnGetData(18)
// it should give me data for customer id=2 Right? but still i am getting the old data i.e customer Data having id=19.
[/code]
i am not getting why i am not getting the right data after sorting? how should i get the correct data with row id after dataTable
sorting?
This discussion has been closed.
Replies
Allan
Allan
customerTable._('tr')[18]