Custom properties in oSettings?

Custom properties in oSettings?

ShatyUTShatyUT Posts: 6Questions: 0Answers: 0
edited April 2012 in General
Is it possible to add custom properties to oSettings at init time? For example, can I do something like this?

[code]
$("#data_table").dataTable({
"customProp": "someValue".
"aoColumnDefs": [
{ "fnRender": renderColumn, "aTargets": [1] }
]
});

function renderColumn( oObj ) {
return oObj.oSettings.customProp;
}
[/code]

I know I can add custom properties to oSettings after initialization but I need this property to be available in the fnRender method.

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    No I'm afraid not, but can you just use a closure to send the parameter to the rendering function?

    [code]
    $("#data_table").dataTable({
    "aoColumnDefs": [
    {
    "fnRender": function ( o, val ) {
    renderColumn( o, val, extraParam );
    },
    "aTargets": [1]
    }
    ]
    });
    [/code]

    Allan
  • ShatyUTShatyUT Posts: 6Questions: 0Answers: 0
    That's what I ended up doing. Not the prettiest solution but it's working. Thanks!
This discussion has been closed.