Datatables editor. copy de value from one variable to another

Datatables editor. copy de value from one variable to another

trebmaltrebmal Posts: 17Questions: 4Answers: 0

Hello to all,

I need to copy the value of a record from one table to another record in the same table , at the time of clicking on the edit form.

I found this code in the forum :

{" label": " premi_actual " , "name": " t_merkur.premi_old " data : function ( val ) { var dd = " 1233 " ; dd = return val ; }} ,

How I can replace the fixed value of the above code "1233", by the value of another variable: " t_merkur.premi_new "

Thanks

Answers

  • trebmaltrebmal Posts: 17Questions: 4Answers: 0
    edited January 2016

    changeg from discursion to a question

    Sorry and thanks

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin

    I would suggest using initEdit rather than a data function (which can get very complicates since you need to handle setters as well as getters).

    How about something like:

    editor.on( 'initEdit', function () {
      editor.field( 'name1' ).set( editor.field( 'name2' ).get() );
    } );
    

    Allan

This discussion has been closed.