EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: harik on December 03, 2014, 11:43:00 PM



Title: Datagrid(subgrid) field editor is not getting the composite data in edit mode
Post by: harik on December 03, 2014, 11:43:00 PM
I am unable to display composite data in text field in edit mode for subgrid. In the below example json, subgrid iterates "categories" data and in edit mode editor is not displaying the "categoryClaim.description" value. Could you please suggest me which editor is satisfies my requirement to get data in edit mode of text fields like composite values "categoryClaim.description".

Example json:
------------

row= {"id":1,"reference":"refer1","description":"Descr 3","details":"Details 3","personName":"Person 3","hyperlink":"Hlink 3","active":true,"categories":[{"id":1,"description":"Category 1","masterId":1,"active":true,"categoryClaim":{"id":3,"description":"Claims 1","categoryId":1}},{"id":2,"description":"Category 2","masterId":1,"active":true,"categoryClaim":{"id":2,"description":"Claims 4","categoryId":2}}]}


my subgrid looklike:
------------------

view : detailview,
detailFormatter : function(index,row) {
return '<div style="padding:2px"><table class="subdg"></table></div>';
},
onExpandRow: function(index, row){                         
   var subdg = $(this).datagrid('getRowDetail',index).find('table.subdg');
   subdg.datagrid({
   data : row,
   method : "get",
   loadFilter: function(row){   
     return {
      total: row.categories.length,
      rows: row.categories
     };
   },
   fitColumns:true,
   singleSelect:true,
   rownumbers:true,
   loadMsg:'',
   height:'auto',   
   columns:[[
          {field : "id",hidden : true},
          {field:'description',title:jQuery.i18n.prop("js.eipscitation.columns.category"),width:30,         
           editor:{
            type:'validatebox',
            options:{
            required:true
            }
           }

          },
          {field:'categoryClaim.description',title:jQuery.i18n.prop("js.eipscitation.columns.claims"),width:30,
           formatter : function(value, row, index) {       
            return row.categoryClaim.description;           
           },
           editor:{
            type:'validatebox',
            options:{
            required:true
            }
           }

          }         
          ]],
          onResize:function(){
           self.dg.datagrid('fixDetailRowHeight',index);
          },
          onLoadSuccess:function(){
           setTimeout(function(){
            self.dg.datagrid('fixDetailRowHeight',index);
           },0);
          }
   });
   self.dg.datagrid('fixDetailRowHeight',index);
},