updating select choices

updating select choices

bfarkasbfarkas Posts: 181Questions: 48Answers: 0

I was trying to write a function that would update the select choices for a dropdown on draw events:

    p200table.on( 'draw', function () {
    var nest1data = p200table.row(0).data()[1];
    var nest2data = p200table.row(0).data()[2];
    var nest3data = p200table.row(0).data()[3];
    p200editor.field('nest').update( [
    nest1data, nest2data, nest3data
] );
} );

When I replace the array string with text, i.e. 'test1', 'test2', 'test3'
it works as expected. What am i missing?
The goal is to update the choices with the values in the first row cells 2,3,4

Answers

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    I think fixed this, or at least it works now:

    p200table.on( 'draw', function () {
        var nest1data = p200table.cell( p200table.row( 0 ), p200table.column( 1 )).data()
        var nest2data = p200table.cell( p200table.row( 0 ), p200table.column( 2 )).data()
        var nest3data = p200table.cell( p200table.row( 0 ), p200table.column( 3 )).data()
        p200editor.field('nest').update( [
            nest1data, nest2data, nest3data
        ] );
    
This discussion has been closed.