Update form fnRemder to mRender
Update form fnRemder to mRender
Hello,
I see the fnRender code is depreciated! It will be replaced by mRender. How to change the code so it will work wit mRender?
How to update the following code to mRender?
[code]
"fnRender": function ( o, val ) {
return o.aData[4];
}
[/code]
Greetings Michel
I see the fnRender code is depreciated! It will be replaced by mRender. How to change the code so it will work wit mRender?
How to update the following code to mRender?
[code]
"fnRender": function ( o, val ) {
return o.aData[4];
}
[/code]
Greetings Michel
This discussion has been closed.
Replies
[code]
mData: "aData.4"
[/code]
Allan
I tried:
mData: "aData.4"
"mData": "aData.4"
"mData": "o.aData[4]"
[code]
mData: 4
[/code]
Allan
THis is part of the code:
{
"mDataProp": null,
"sClass": "control center",
"sWidth": "20px",
"bSortable": false,
"sDefaultContent": ''
},
{
"mDataProp": null,
mData: 4
},
{
"mDataProp": null,
"fnRender": function ( o, val ) {
return o.aData[2];
}
},
[code]
"mDataProp": null,
mData: 4
[/code]
mData and mDataProp are the same thing (mData is the new name for it). You should not use both in the same object.
Allan
Greetings,
Michel
Allan
Greetings
Michel
Michel
Allan
How to replace the depreciated function fnRender by mData?
How to expand all the extra rows using the drilldon option automatically on pageload?
Michel
[code]
{
"mDataProp": null,
"fnRender": function ( o, val ) {
return o.aData[1];
}
},
[/code]
Dropping fnRender and using just mData you would have:
[code]
{
mData: 1
}
[/code]
In fact, since that's for column 1, you don't need that at all - it is completely redundant since DataTables will assign he column index by default.
In something ever so slightly more complicated:
[code]
"fnRender": function ( o, val ) {
return '';
},
[/code]
would become:
[code]
{
mData: 3,
mRender: function ( data, type, row ) {
return '';
}
}
[/code]
And again, assigning mData is actually redundant since it would be 3 by default anyway (column index3).
Allan
Do you have an answer to my second question also?
Michel
`$('tbody tr').click();` perhaps? Just trigger the event.
{
"mDataProp": null,
"fnRender": function ( o, val ) {
return o.aData[4];
},
"sClass": "align-top",
"sWidth": "140px"
},
{
"mDataProp": null,
"fnRender": function ( o, val ) {
return nl2br(o.aData[8]);
},
"bSortable": false,
"sClass": "align-top"
},
to
{
mData: 4,
"sClass": "align-top",
"sWidth": "140px"
},
{
"mData: 8,
mRender: function ( data, type, row ) {
return nl2br(data);
},
"bSortable": false,
"sClass": "align-top"
},
But this wil not return the value of the 8 row in the database but the 5th!!
How to make it use the value out of the 8 th row?
Michel
$.fn.DataTable.version
"1.9.2"
[/quote]
mData and mRender were introduced in 1.9.4... Please update to the latest version.
Question where and how to add this code?
I can not get it to work. I am not an expert in javascript/ jquery!
I send you an example . Is it possible to give me an example.
I think - looking at the forum - that there will be a lot of persons who would like to use that option!!
[quote]
jquery.rateit.min.js:4
TypeError: 'undefined' is not an object (evaluating 'b[0].nodeName')
[/quote]
I tried the IE/ Google and Safari browser.
I however uploaded an second example without the rateit script!
http://www.bergmanonlineshop.nl/test2.html
It now drills down the row but isn't returning the right info!
It also will not show the image (+) and (-).
Also added an example using 1.9.2!
http://www.bergmanonlineshop.nl/test2.html (1.9.4)
http://www.bergmanonlineshop.nl/test3.html (1.9.2)
Allan
Problem:
How to change the code where more then one input mData value is used?
[code]
{
"mDataProp": null,
"fnRender": function ( o, val ) {
var dt_edit = '';
dt_edit = 'Bewerken';
var dt_remove = '';
dt_remove = 'Verwijderen';
return dt_edit+dt_remove;
},
"sClass": "align-center align-top",
"sWidth": "70px",
"bSortable": false
}
[/code]
Question:
How to load the table with all of the drilldowns expanded/ opened?
You told me to use
[quote]allan said: $('tbody tr').click(); perhaps? Just trigger the event. [/quote]
But where and how to add this code to the page (http://www.bergmanonlineshop.nl/test2.html)
Hope you ca help so I can continu with my project?
[code]
$('tbody tr td.control').click();
[/code]
Allan