I have a grid where the columns are dynamic. By default (no schema set) all the columns are strings which causes the sorting to not be that helpful.
I use a web service that returns json to get the data for the grid, can I define the column types there or would that be a separate call?
Once I know the column types is it possible to set the column format based on the type?
I have some code that defines the field type for columns if I know their exact name but that isn't very practical because there are many different possible column names.
I also have some code that sets the template or format for a given column but it is also hard coded and not scalable.
Any help would be appreciated.
I use a web service that returns json to get the data for the grid, can I define the column types there or would that be a separate call?
Once I know the column types is it possible to set the column format based on the type?
I have some code that defines the field type for columns if I know their exact name but that isn't very practical because there are many different possible column names.
schema: {
model: {
fields: {
ReportDate: {
type:
"date"
},
Age: {
type:
"number"
}
}
}
}
//make first column a link using values from two columns
columns[0].template =
"<a href='somepage.html?rid=#=ReportID#' target='_blank'>#=ReportNum#</a>"
;
//make sure value in 3rd column is formatted as a date
columns[2].format =
"{0:M/d/yyyy h:mm tt}"
;