[Editor] - Update field in a specific Row

[Editor] - Update field in a specific Row

VascoOliveiraVascoOliveira Posts: 22Questions: 7Answers: 0

According to the Editor field().multiSet() documentation, it allows to edit a field in a specific row, using:

editor.field('fieldname').multiSet(<ROW_ID>, account.value);

Unfortunately, its not working.

Jquery: 1.12.4
Datatables: 1.10.16
Editor: 1.7.3

Debugger information here.

Am i missing something? Shouldn't the field().multiSet() allow to set a field in a specific row?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Could you show me the code you are using (unfortunately the debugger doesn't show that), and also explain how you are triggering the field().multiSet() method please?

    Thanks,
    Allan

  • VascoOliveiraVascoOliveira Posts: 22Questions: 7Answers: 0

    The method is triggered by a simple function call, and its as simple as:

    function updateRow(){
     editor.field('field1').multiSet( 'DT_ID_1', 'New Info' );
    }
    

    Please note that initially i was editing the cell directly, and that workedas expected:

    function updateRow(){
                const dtrow = datatable.row({selected: true});
                const field1Cell = datatable.cell(dtrow, 1);
                field1Cell.data('New Info');
    }
    
  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Have you triggered editing on the DT_ID_1 by the time you call that? You need to have activating editing on the row to be able to set its value.

    Allan

  • VascoOliveiraVascoOliveira Posts: 22Questions: 7Answers: 0

    No, i haven't.

    Is it possible to trigger editing programmatically?

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    Yes - edit() can be used to trigger editing. It also has options to show (or not) the form as needed.

    This example shows an application of that.

    Allan

This discussion has been closed.