Form with datatable does not load table data from nested json

Method form.load loads element values of the form mapping to json names except datatable.

json example:
{ "plan": false,
"details": [{"value": 100},
{"value": 300}

Of course it is possible to load it after like ($$('details') is datatable)

  $$('editform').load(elementUrl + "/" + id).then(function(data){
      data = data.json();

But it would be nice if loading will work right out of the box.

Thank you.


  • Hello, @Mika

    If you want to use datatable as a form simple control, you need to define the setValue and getValue methods for the datatable, i.e. to create a custom component:

        $allowsClear:true,     // reflect to form.clearAll()
        setValue:function(value){ . . . },
        getValue:function(){ . . .  }
    }, webix.ui.datatable);

    A very common use-case is setting/getting the selection:

    In case of data loading the methods should be configured as follows:

    Besides, you still can load the data using the id of the particular component.

  • Hello, Alena,

    It works, thank you!

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!

In this Discussion