Posted 4 February 2019, 6:17 pm EST
I just downloaded the Wijmo demo and am trying to load data from the model into a FlexGrid control in the viewer. Do you have any examples that will show me how to do that?
Thanks, Ed
Forums Home / Wijmo / General Discussion
Posted by: ed on 4 February 2019, 6:17 pm EST
Posted 4 February 2019, 6:17 pm EST
I just downloaded the Wijmo demo and am trying to load data from the model into a FlexGrid control in the viewer. Do you have any examples that will show me how to do that?
Thanks, Ed
Posted 5 February 2019, 7:17 am EST
Hello,
For this, you need to convert Model data to JavaScript JSON to assign the FlexGrid object.
For reference, please refer to the following code snippet:
@model IEnumerable<Car>
<link href="https://cdn.grapecity.com/wijmo/5.20183.568/styles/wijmo.min.css" rel="stylesheet" />
<script src="https://cdn.grapecity.com/wijmo/5.20183.550/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.20183.550/controls/wijmo.grid.min.js"></script>
<div id="grid1"></div>
<script>
onload = function () {
var items=@Html.Raw(Json.Serialize(Model));
new wijmo.grid.FlexGrid('#grid1', {
itemsSource: items
});
}
</script>
Hope it helps, if you have any further question, please let us know!
~Manish