How to add a new custom function to all records in add datatable like toString()?

Is there any override?

actually I need to add below function to all records in datatable. Since lot of other frame work existing code using this scenario to get fields data.
get: function() {
return this.XYZ;
}

Comments

  • edited July 12

    Hey @webix_B_123, you can achieve this with the help of scheme, where you can apply a new property on $init containing your function to all the records in the data store. Here's an example: https://snippet.webix.com/rxwqbpbd.

  • Ohh that's nice..
    Already in "scheme" I am using "$change". If I use both "$init" and "$change" both will right?

    scheme: {
    $change: function() {....}
    }

  • edited July 15

    Here I observed. if I add "$init", "$change" is not calling.

    In $change I am changing row $css. May be we can achieve this in $init?

  • edited July 15

    Is it possible to call both functions? since we are doing some functionality on record change/update ("$change").

  • if you use $init, then $change will not be called on item init.
    if you use $update, then $change will not be called on item update.
    you can use $change only and put some flag to item to know that it is initialized

    {
        $change: function(item){
            if(item.__init__) {
                    //do update
            } else {
                item.__init__ = 1;
                    //do init
            }
        }
    }
    
  • Ohh That's fine

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!