This is a migrated thread and some comments may be shown as answers.

grid with inconsistent data

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ishay
Top achievements
Rank 1
Ishay asked on 11 Jun 2012, 01:35 PM
Hi, 
i need to display a grid with dynamic data, i have no previous knowledge regarding my columns, 
additionally the objects\rows are not consistent, for example:

var users = [{"a":"1","c":"1"},
        {"a":"2","b":"2","c":"2"},
        {"a":"3","b":"3","c":"3"},
        {"a":"4","b":"4","c":"4","d":"4"}]

when passing this kind of data to a Kendo grid, it sometimes displays the common attributes and sometimes don't display anything.

is there a way to make it display null values for missing values?

sample - http://jsfiddle.net/76aZ7/20/

Thanks, 
Ishay

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 13 Jun 2012, 08:40 AM
Hello Ishay,

I am afraid that this scenario, without no previous knowledge of the columns, is not supported. If you insist you may try to modify the raw data that is coming from the server and build an array of new objects (e.g. assign null values, etc) at the data function of the schema:
var dataSource = new kendo.data.DataSource({
    data: users,
    schema: {
        data: function(data) {
            //data - raw data received from the Ajax request
            //do something with the data
            return dataArray;
        }
     }
})


Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Ishay
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or