Little bug in fnReOrderIndex when defining columns in aoColumns.
Little bug in fnReOrderIndex when defining columns in aoColumns.
![ruimg](https://secure.gravatar.com/avatar/c4968085699c48dfd9c49a91eb60071d/?default=https%3A%2F%2Fvanillicon.com%2Fc4968085699c48dfd9c49a91eb60071d_200.png&rating=g&size=120)
I was trying to implement a bServerSide table by defining the columns in aoColumns like so
[code]
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "users/list",
"aoColumns": [
{ "sName": "id", "sTitle" : "Id" },
{ "sName": "username", "sTitle" : "Username"},
{ "sName": "name", "sTitle" : "Nome"},
{ "sName": "contact", "sTitle" : "Contacto"},
{ "sName": "note", "sTitle" : "Nota"},
{ "sName": "date_created", "sTitle" : "Criado"},
{ "sName": "role", "sTitle" : "Data"},
],
[/code]
The server side datasource has more columns than the ones I want to display, I want it to be easily configured in the client side, and the datasource can change over time.
So when I was doing this, I couldn't get it to work, so debugging the code I saw a little error in _fnReOrderIndex.
Here is my fix.
[code]
function _fnReOrderIndex ( oSettings, sColumns )
{
var aColumns = sColumns.split(',');
var aColumnsLen = aColumns.length;
var aiReturn = [];
for ( var i=0, iLen=oSettings.aoColumns.length ; i
[code]
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "users/list",
"aoColumns": [
{ "sName": "id", "sTitle" : "Id" },
{ "sName": "username", "sTitle" : "Username"},
{ "sName": "name", "sTitle" : "Nome"},
{ "sName": "contact", "sTitle" : "Contacto"},
{ "sName": "note", "sTitle" : "Nota"},
{ "sName": "date_created", "sTitle" : "Criado"},
{ "sName": "role", "sTitle" : "Data"},
],
[/code]
The server side datasource has more columns than the ones I want to display, I want it to be easily configured in the client side, and the datasource can change over time.
So when I was doing this, I couldn't get it to work, so debugging the code I saw a little error in _fnReOrderIndex.
Here is my fix.
[code]
function _fnReOrderIndex ( oSettings, sColumns )
{
var aColumns = sColumns.split(',');
var aColumnsLen = aColumns.length;
var aiReturn = [];
for ( var i=0, iLen=oSettings.aoColumns.length ; i
This discussion has been closed.