Custom columns (add/edit/delete/...)

Custom columns (add/edit/delete/...)

typhoon1978typhoon1978 Posts: 2Questions: 0Answers: 0
edited November 2012 in DataTables 1.9
Hi all,

I use DataTables in a lot of projects C# and Java, until version 1.9.3 I had no problem, but after I upgraded to version 1.9.4 I'm experiencing some trouble with extra columns. This is my dataset declaration:

[code]
var dataSet = [ {
"mDataProp" : "id",
"sTitle" : "ID",
"sClass" : "cell-right"
}, {
"mDataProp" : "type",
"sTitle" : "Tipo",
"sClass" : "cell-left"
}, {
"mDataProp" : "protocolCode",
"sTitle" : "Protocollo",
"sClass" : "cell-left"
}, {
"mDataProp" : "state",
"sTitle" : "Stato",
"sClass" : "cell-left"
}, {
"mDataProp" : "creationDate",
"sTitle" : "Data creazione",
"sClass" : "cell-right",
"fnRender" : function(obj) {
var insertTime = obj.aData["creationDate"];
if (insertTime != null) {
return $.format.date(new Date(insertTime), 'dd/MM/yyyy HH:mm:ss');
} else {
return "-";
}
},
"bUseRendered" : true
}, {
"mDataProp" : null,
"bSearchable" : false,
"bSortable" : false,
"sClass" : "cell-center",
"fnRender" : function(obj) {
return "";
}
}, {
"mDataProp" : null,
"bSearchable" : false,
"bSortable" : false,
"sClass" : "cell-center",
"fnRender" : function(obj) {
return "";
}
} ];
[/code]

my extra columns declare a mDataProp equal to null, in version 1.9.3 these columns were sent to backend as null (as declared), but in 1.9.4 they are sent as integer (column index). Why ?
I tried also to ignore them server side but ignoring means that dataTables warns me about extra columns which are not sent back by the server (via json).
I found this kind of mechanism not so elegant and not generic so I reverted to 1.9.3.

On the server side I have generic methods which handle all my tables and each table could have different actions (view detail or delete or edit or whatever I like) and handling this means implementing specific actions on the server side.

I found really elegant the previous mechanism and it was also coherent with the mvc pattern, because server doesn't know anything about the frontend, it serves and processes data, nothing else. It is not frontend-centric and doesn't want to have to do with specific gui problems, expecially if we are speaking of non-scripting languages and strong typed languages. Don't you agree ?

Let me know.
Thanks in advance and best regards,
Alex.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Use mData rather than mDataProp in 1.9.4. There is a bug in 1.9.4 where setting mDataProp as null should also set mData,but it doesn't (it does for everything other than null).

    Allan
  • typhoon1978typhoon1978 Posts: 2Questions: 0Answers: 0
    Ok thanks, I'll try asap.
This discussion has been closed.