ColReorder overrides aoColumnDefs?
ColReorder overrides aoColumnDefs?
Hi everyone!
I'm kind of new using DataTables and I think is awesome!
I was tweaking a little bit the column rendering defining the mRender inside aoColumnDefs on initialization. And I have also included the ColReorder plugin. All was good, but when I move a column, and then change the page, the rendering doesn't work. Like I said, I'm new on this and all I can think of is when I move a column, the aoColumnDefs is overrided by ColReorder plugin. This is right? There is some workaround?
Thanks in advance!
Regards!
PS. Sorry about my english
I'm kind of new using DataTables and I think is awesome!
I was tweaking a little bit the column rendering defining the mRender inside aoColumnDefs on initialization. And I have also included the ColReorder plugin. All was good, but when I move a column, and then change the page, the rendering doesn't work. Like I said, I'm new on this and all I can think of is when I move a column, the aoColumnDefs is overrided by ColReorder plugin. This is right? There is some workaround?
Thanks in advance!
Regards!
PS. Sorry about my english
This discussion has been closed.
Replies
But no doubt what you're asking is possible
[code]
self = this;
self.table_id = "#the_table_id";
self.the_table = $(self.table_id).dataTable({
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": true,
"sDom": 'T<"clear"><"top"l>rtipR',
"bPaginate": true,
"sPaginationType": "bootstrap",
"bSortCellsTop": true,
"iDeferLoading": 0,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "webservice/getdatatablesws.php",
"aoColumnDefs": [
{
"mRender": function ( data, type, row ) {
var html_col = '';
var img_filename = data;
html_col += " ";
html_col += " ";
html_col += " ";
return html_col;
},
"aTargets": [ 1 ]
}
]
});
[/code]
When I go through pages, all works good, but when I reorder some column and after that change the page, I see the "filename" of the image instead of the image itself.
Do you have a clue?
Thanks in advance.
Regards
Allan
Exactly, my server side script isn't taking account of reorder. I still have to do that. But, in this case I have 4 columns. Id, Image, Name, SKU. If I swap Name -> SKU, beyond the issue about what data goes to what column, the mRender defined is not executed. Using firebug, I put a break on line 20 (see example above) and it execute in each draw, but when I swap some columns, and change the results page, then I see no execution on line 20.
Sorry about my lame english. It's even worst when I get nervious about a problem, ha.
Thanks Allan to participate on this thread.
Regards
I can't say why your own script isn't taking into account the reordered columns as I don't know what it looks like :-)
Allan
But maybe I'm not so clear. My problem is not the missplaced column data (actually, I have to solve that yet, but I already know how to do that), the problem here is the non-execution of the customized rendering function I defined to return an tag, instead of the image file name.
I follow this example:
http://datatables.net/release-datatables/examples/advanced_init/column_render.html
and it works like a charm! At least until I reorder a column, and then the mRender is not executed anymore.
That's why on the tittle I write "ColReorder overrides aoColumnDefs?"
Thanks in advance!
Regards
Allan
From:
[code]
"aTargets": [ 1 ]
[/code]
To:
[code]
"aTargets": [ 'image_filename' ]
[/code]
Thanks again!
Allan
I don't have enough words to thank you!