How to pass json data to webix text

Viewed 99

Good day, i'm new to webix and codeigniter, i wanna ask if after getting the json from controller the format is like {End_date: "2019-07-31", value: "2019-07-31"} in console log, how to display on webix text?

    function GetEndDate() {
    return $.ajax('<?php echo base_url(); ? 
    >index.php/date/dateController/GetEndDate/' + Id);
    }


    webix.ready(function(){
            $.when(GetEndDate()).done(function(EndDates){
                EndDate = EndDates[0];
                rendersformSection();
         });
    });


    function rendersformSection(){
    {view:'text', id:'Final_date', name:'Final_date', labelAlign: 
    'right',label:'Final Date', labelWidth:200,
suggest: {
 filter: function (item, value) {
    if (item.value.toString().toLowerCase().indexOf(value.toLowerCase()) >= 0)
    return true;
    return false;
 },
 body: {
     data: EndDate,
     datatype: "json",
     template: function(obj){
     return obj.End_date;
  }
 }
},
     on: {
         onBeforeShow: function () {
              var texts = [];
              EndDate.forEach(function (obj) {
              texts.push(obj.value);
          });
 }
}
webix.ui(rendersformSection);
}

I expect when the page load. the final date will show the date get from the function GetEndDate().

0 Answers
Related