EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: cdy328 on April 26, 2015, 08:15:58 PM



Title: Can I insert dynamic rows,after the columns is created dynamic in datagrid?
Post by: cdy328 on April 26, 2015, 08:15:58 PM
I have dynamic columns,and defined it's "field",
but when I use the method "appendRow",then show errors:
"SyntaxError: missing : after property id",
but it works well in this method "newID0:0"
(the value of "fields[1]" is "newID0")

How can I change my codes,if I want dynamic columns and dynamic
rows in datagrid?

Thanks in advance :)

// create dynamic columns
columns[0].push({
   title : result.operatorUserName,
   // define "field" here,and later,I put it to fields[]
   field : "newID" + i,
   width : 90
});

// append dynamic rows
for(var m=0; m<items.length; m++){
   $('#id_list_query').edatagrid(
   'appendRow',{
      //"SyntaxError: missing : after property id"
      fields[1]:0
      // bug,it works well when use "newID0:0"
   });
}


Title: Re: Can I insert dynamic rows,after the columns is created dynamic in datagrid?
Post by: stworthy on April 27, 2015, 07:27:10 AM
To dynamic change the datagrid's columns, please refer to this tutorial http://www.jeasyui.com/tutorial/datagrid/datagrid6.php.