using mRender, how can I give radio buttons unique name per row?

using mRender, how can I give radio buttons unique name per row?

rolfsfrolfsf Posts: 27Questions: 6Answers: 0
edited February 2014 in DataTables 1.9
Very simply, I'm building a table dynamically (as well as adding/removing rows dynamically), and each row will contain 4 columns. Three of the columns will be radio buttons. To function properly I need to give each row's set of radio buttons a unique name ... e.g.

I can't figure out how to get that unique number for the name within mRender... whether it's the rowIndex or some other internal dataTable reference.

right now, my mRender looks like this:
[code]
aTargets: [1,2,3],
mData: null,
mRender: function (data, type, full) {
if (type == 'display') {
return '';
}
return data;
}

[/code]

Any advice?
Thanks!

Replies

  • allanallan Posts: 54,914Questions: 1Answers: 8,608 Site admin
    edited February 2014
    Do you have some unique identifier in the data source for the row? You can access the full data object for the row using the `full` parameter in your function above.

    Allan
  • rolfsfrolfsf Posts: 27Questions: 6Answers: 0
    Well, column[0] has a unique string... but it can be pretty long with multiple words. I'm actually building the table on the fly from selections in a multi-select widget... so perhaps I can add an identifier to the multi-select items and pass that along with the item

    thanks Allan... I'll keep tinkering for a while
  • allanallan Posts: 54,914Questions: 1Answers: 8,608 Site admin
    mRender itself won't give you a unique number I'm afraid. I suppose possibly it could pass in the row index, but I'm afraid that currently it doesn't.

    Allan
  • rolfsfrolfsf Posts: 27Questions: 6Answers: 0
    Yeah, realizing that. It's ok, it's forcing me to come up with a better solution than my original... I hope ;-)
  • roncemerroncemer Posts: 4Questions: 0Answers: 0

    As I mentioned elsewhere, this is a major oversight on the part of the DataTables development team. The oObj argument to fnRender() had everything one would need to get access to the inner workings of the DataTable, including accessing aoColumnDefs / aoColumns to find a column index for a specific column name, joining in data from other columns (first name / last name concatenation), line numbering (Sales Order, Purchase Order details entry), dynamically rendering cells as editable or not editable, unlimited uses. Not having access to the oObj object in mData() and mRender() is a show-stopper for upgrading to DataTables 1.10. Even doing simple things such as numbering rows (oObj.iDataRow) is now impossible using mRender().

    Please either provide oObj as a fourth parameter to mData() / mRender(), or put fnRender() / bUseRendered functionality back. Preferably both. It seems as if you could add oObj as a fourth argument to mData() / mRender(), and then write a migration plugin (a la jquery-migration) which provides the missing fnRender() functionality by hooking mData() or mRender() (mData() if bUseRendered is true; mRender() if it's false).

    How quickly can we get this very important functionality restored?

  • allanallan Posts: 54,914Questions: 1Answers: 8,608 Site admin

    Thanks for the feedback. i've replied to your other comment on this topic here.

    Allan

This discussion has been closed.