Declined
Last Updated: 27 Feb 2015 21:31 by ADMIN
Steven
Created on: 03 May 2012 16:26
Category: Kendo UI for jQuery
Type: Feature Request
2
Single definition for datasources and grids
I find myself having to define fields and columns multiple times for use in grids and data sources.   It would be nice to be able to use a single structure that would work for both.   The visible setting would control if the field is displayed in the grid or not.   

For example:

    _myColumns = [
        { field: "Position.Name", title: "Position", width: 20, type: "string", editable: true, visible: false },
        { field: "Headcount.value", title: "Headcount", width: 15, type: "string", editable: true  },
        { field: "FTE.value", title: "FTE", width: 15, type: "string", editable: true  },
        { field: "EmployeeName.value", title: "EmployeeName", width: 50, type: "string", editable: true  },
        { field: "JobCode.value", title: "JobCode", width: 20, type: "string", editable: true  },
        { field: "JobTitle.value", title: "JobTitle", width: 100, type: "string", editable: true  }
    ]

then, this can be used in $().kendoGrid( { columns: mycolumns } ) and the data source $().kendo.data.DataSource( { fields: mycolumns } ). 
1 comment
ADMIN
Brandon
Posted on: 06 Jun 2013 18:09
this works, though your _muColumns variable should lose the underscore to be consistent with the other places it's used.