Webix Jet bind datatable and form

How bind databable and form?

View


define([
    "models/settings"
],function(settings){

var ui = {
cols : [
        { 
          view:"datatable",
          id:"rating:table",
          columns:[
            { id:"code",    header:"Code", editor:"text"},
            { id:"rate",    header:"Rate", editor:"text"},
          ],
          datatype:"json",
          select:"row",
          editable:true,
          editaction: "dblclick",          
          autowidth:true
        },
        {
          view : "form",
          id: "rating:form",
          rows : [
            { view : "text", label : "Code", name : "code", width: 300 },
            { view : "text", label : "Rate", name : "rate" },
            { view : "button", label : "Save", type: "form", click: '$$("rating:form").save' }
          ]
        }
      ]        
        
    };

    return {
        $ui: ui,
        $oninit:function(view,$scope) {
        $$("rating:table").parse(
            [{
                "code": 112,
                "rate": 1,
              }, {
                "code": 114,
                "rate": 3,
              }
            ]
        );            
        $$("rating:form").bind($$("rating:table"));
    },
    };  
});

Selection of any datatable item will result in the form filling with data from the table.

There is error "webix.$$(...) is null" by clicking on button Save in the form.

Can you help me save data?

Comments

  • Change click handler like next

    click:function(){ this.getFormView().save() }
  • alsals
    edited March 21

    It works, thanks! )

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!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion