New callback after fnRender

New callback after fnRender

danut007rodanut007ro Posts: 3Questions: 0Answers: 0
edited January 2012 in General
Hello!

I need to add new lines to a table, but I need to add buttons and handlers for them. I saw that I can do this using fnRowCallback.
Wouldn't it be nicer if there would be another callback after fnRender that also passes the created TD element so I can manipulate it as I want?
I would like to have a cell that can have an input text as mDataProp and a button to remove that specific line from the table.

Any help or other ideas please?
Thanks

Replies

  • danut007rodanut007ro Posts: 3Questions: 0Answers: 0
    Well, I solved the problem, now maybe Allan will look into it and add it as a feature.

    I added something like this code in a few places (3 actually, where fnRender was called) :
    [code]
    if ( typeof oCol.fnRenderAfter === 'function' )
    {
    oCol.fnRenderAfter(
    {
    "iDataRow": iRow,
    "iDataColumn": iColumn,
    "aData": oData._aData,
    "oSettings": oSettings,
    "mDataProp": oCol.mDataProp,
    "nTd": nCell
    }, _fnGetCellData(oSettings, iRow, iColumn, 'display')
    );
    }
    [/code]

    I will try to contact him if he's interested to see my code.
    Thanks Allan, nice piece of work
  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    Hi,

    Thanks very much for the post! I've actually beaten you to this new feature (although not by much!) ;-).

    DataTables 1.9 (currently in beta) introduces two new callbacks - fnCreatedCell and fnCreatedRow. These are called when a cell / row is created, which is very useful for exactly the kind of reasons that I'm sure you are well aware of having done this yourself!

    http://datatables.net/docs/DataTables/1.9.beta.2/DataTable.defaults.columns.html#fnCreatedCell
    http://datatables.net/docs/DataTables/1.9.beta.2/DataTable.defaults.html#fnCreatedRow

    Regards,
    Allan
This discussion has been closed.