Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82226

Editor dependent is causing an infinite loop, when I try to setup field change based on the data

$
0
0

So I got a dropdown Status, which no options in them. Because I want the following based on the column data it fills up.

Ex: if Status is "Active" then I "Active", and "Inactive", If its "Inactive", then "Inactive", "Reactive", and if its "Reactive", I need "Inactive", "Reactive".

 {
     label: 'Status',
     name: 'Status',
     type: 'select',
     options: []
 }

Dependent but runs in infinity loop.

Code:

editor.dependent('Status', function (val, data, callback) {

    let options = [];

    if (data.row.Status === "Inactive") {
        console.log('changing options: 1')
        editor.field('Status').update(['Inactive', 'Reactive'])
    } else if (data.row.Status === "Active") {
        console.log('Changing 2')
        editor.field('Status').update(['Inactive', 'Reactive'])
    } else if (data.row.Status === "Reactive") {
        console.log('Changing 3')
        editor.field('Status').update(['Inactive', 'Reactive'])
    }
}

Viewing all articles
Browse latest Browse all 82226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>