Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
Binding Empty Data Source Remote
posted

Hello,

We are using a remote data source with igGrid (Infragistics version 2013.2) in an ASP.NET application.

The behavior we are after is that when the user enters a filter value that doesn't exist in the grid, our server web method (that the grid automatically calls on remote sorting) will return an empty row set (but a full column set) so that the grid can still keep its auto generated columns but have no rows. Currently we are building the JSON string on the server and pushing it back to the client via HTTP response. How would the JSON string need to look in order to bind the columns but no rows in igGrid?

Since our data sets are user generated and we cannot know what columns will be included until runtime we are using autogeneratecolumns : true in igGrid.

An example of our JSON with rows:

 {
"totalRowCount":1,
"data":
    [{"ColA" : "A"},
    {"ColB" : "B"}
    ]
}

How do we return that JSON if it had 0 rows?

Parents
No Data
Reply
  • 10685
    Offline posted

    Hello Johan, 

    In order to set the column only and no data in the grid, it is possible to set the columns to autoGenerateColumns =false and using an AJAX call manually define the columns to be rendered. Using this approach the igGrid will render as an empty and only the columns will be defined. You could afterwards use the dataSourceUrl in order to link the grid to the data already available (and enable autoGenerateColumns=true if required).  

    Please let me know if you have more questions regarding this!

Children