Custom button to pass id field to custom function

Custom button to pass id field to custom function

webvisionwebvision Posts: 10Questions: 7Answers: 0

I'm currently creating a custom button at render using the following code. It creates a per row inline link allowing me to pass a record id full.id to new page:

{
     "data": null,
     "render": function ( data, type, full, meta ) {
     return '<a href="index.cfm?image=1&cid=2&wid=2&did='+full.id+'">View</a>';
     }
}

How would I accomplish this same task using a custom toolbar button. I would like to customize a toolbar button to pass the "selected row" record id. Instead of using the custom inline method at render. The reason is the render method interferes with the 'responsive' class and breaks the responsive behavior.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Sounds like you need an event handler on your button which will call the row().data() method to get the data for the row (and therefore the id) based on the selected row (which I presume you can use a selector for, based on however you are selecting rows?).

    The reason is the render method interferes with the 'responsive' class and breaks the responsive behaviour.

    I'm going to look at that shortly!

    Allan

  • webvisionwebvision Posts: 10Questions: 7Answers: 0

    Allan, could it be your example works because it uses a pre-populated html table?

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Hi,

    It shouldn't make any different whether the data is ajax sourced or anything else - as long as the very latest code for Responsive is being used (i.e. the currently unreleased version).

    Allan

This discussion has been closed.