Append table TR TD and colReorder
Append table TR TD and colReorder
Hi,
When user do a search I have a table append like this filled using Ajax, PHP and jQuery.
I'm also using State Save
var $tr = $('<tr>').append(
$('<td>').html(name),
$('<td>').html(phone),
$('<td>').html(date),
).appendTo('#my-list tbody');
I'm looking for a way (if possible) to use colReorder
at the moment if user change the column order, the data follow the column, then if the user do a new search the column header stay at the new position but the content is rebuild as the original order.
Is there a way if the user change column order to get the value following the new order using append?
Thanks
This question has an accepted answers - jump to answer
Answers
Hi @lenamtl ,
There sounds like there's a lot going on there. We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Unfortunately I cannot set a demo for this as it using MySQL and PHP OOP and this is required a lot of files.
What I d'like to know is how can I match the append column with the new column order?
I'm not too clear on the problem, which is why I asked for the example, but this may help -
column-reorder
- it's triggered when the user reordersC
Hi,
Here is the case
First the user click a button that fill the table
Here is the table that get filled this is working fine as the default value.
Name | Phone | Email
Now let say the user change column order to this
Email | Phone | Name
At this point the data move with the column header.
Column Settings are saved in Save State
Now the user do a new search click a button that fill the table
but the data will not follow the column header
Email | Phone | Name
John | 888-555-6666 | john@test.org
What I would like is to have
Email | Phone | Name
john@test.org | 888-555-6666 | John
If you're adding as an object, then that wouldn't be an issue, since the column definition would be there, i.e.
If you're adding as an array, yep, you'll need some logic. You could use
colReorder.order()
to get the current positions, or iterate through the array, creating a new one based on the results ofcolReorder.transpose()
Hope that helps,
Cheers,
Colin
I'm adding as an array and using var to transform the data
could you give me an example how can I apply the logic with colReorder.order()
colReorder.order()
returns an array with the position of the rows currently. So you would iterate through that, something like this psuedo code:Then just add the newArray ...
Hope that helps,
C