Title: create dynamically datagrig Post by: haltman on April 25, 2012, 01:55:26 AM Does exist a way to create dynamically a datagrid? I mean to post columns and rows with jquery ajax functions like $.post or $.getJSON
thanks in advance ciao h. Title: Re: create dynamically datagrig Post by: Ellipsis on December 04, 2012, 12:18:39 PM I would like the Same feature, it would be enough to be able to create the column of a datagrid with a Json file.
Seems to be pretty straightforward, coverting json to a multidimension array, but an easyui method would be the best way i suppose. Title: Re: create dynamically datagrig Post by: stworthy on December 05, 2012, 12:40:50 AM The 'loadFilter' function will be called before data loaded into datagrid. Here is the simple load filter functionality to dynamic create columns.
Code: <table class="easyui-datagrid" data-options="loadFilter: loadFilter"> The json data to be loaded must contains 'columns' definition, such as: Code: {"total":1,"rows":[{...}],"columns":[[...]]} Title: Re: create dynamically datagrig Post by: Ellipsis on December 05, 2012, 09:09:19 AM Ok, got it working.
I have chosen to build a separate method for retrieving columndata and use underscore.js to translate the json to an array [[]] that holds the objects. (many possible columns needed, so I retrieve them all and cache them) The loadfilter is usable in a whole lot of other scenario's, so I'll try that soon. Thank you. ps. I posted a question about a loadMsg hanging when data retrieve fails, if you have some tips.... |