Loading data from model in MVC Core 2.2

Posted by: ed on 4 February 2019, 9:17 am EST

  • Posted 4 February 2019, 9:17 am 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
  • Marked as Answer

    Replied 4 February 2019, 10:17 pm 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
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels