Is it possible to use a JavaScript function instead of a URL to fill a Flexigrid? The function I want to use returns a JSON object.
Asked
Active
Viewed 1,539 times
2 Answers
0
Finally I found it.
You can call : FlexiGrid.flexAddData(myData);
var myRows = getRows();
var myData = { total: myRows.length , page: 1, rows: myRows };
flexiGrid.flexAddData(eval(myData));
The rows in myRows have to be normal flexigrid rows.

Chris
- 1,610
- 3
- 18
- 37
-
rohitszone's comment: "Could you Please post the function you have written to getRows() to have JSON Object ?? Also what do I mention for url parameter inside flexigrid call ?? Answers might be quite simple, am very new." – Peter O. Feb 18 '12 at 11:20
-
Hi Peter, getRows() has to return a JSON object like this: function getRows(){ return {[{"id":"1","cell":["row1, cell1","row1, cell2"]},{"id":"2","cell":["row2, cell1","row2, cell2"]}]}; } You can leave the url parameter empty. – Chris Feb 28 '12 at 15:06
-1
I think you can do that. Just call the java script method using from flex apis that return JSON object...
- write a JS method that return JSON object,
- List item from flex application call JS method using ExternalInterface.call(JSmethod) api (for more detail please refer to flex doc)
- List item create a ArrayCollection object by parsing JSON object using JSON.decode()
- List item set ArrayCollection object as the data source of the Grid.

majid
- 66
- 6
-
The link is pointing to 'Programming ActionScript 3.0' with javascript example – MagePal Extensions Oct 28 '12 at 19:45