or
dataSource.query({ filter: { field: "Name", operator: "contains", value: searchValue} });
$(
"#grid"
).kendoGrid({
dataSource: {
transport: {
read : { url:
"data/product_list.php"
, dataType :
"json"
} ,
create : { url:
"data/product_create.php"
, type:
"POST"
} ,
update : { url:
"data/product_update.php"
, type:
"POST"
} ,
destroy : { url:
"data/product_delete.php"
, type:
"POST"
}
},
schema: {
data:
"data"
} ,
model: {
id:
"ID"
,
fields : {
ID : {
editable :
false
,
nullable :
true
} ,
product_name : {
editable :
false
,
nullable:
true
} ,
name : { required :
true
} ,
size : { required :
true
} ,
weight : { required :
true
} ,
glossy : { required :
true
} ,
color : { required :
true
}
}
}
},
columns: [{ field:
"ID"
, title :
"id"
, width:
"2em"
} ,
{ field:
"product_name"
, title :
"Product"
} ,
{ field:
"name"
, title:
"Name"
} ,
{ field:
"size"
, title:
"Size"
} ,
{ field:
"weight"
, title:
"Weight"
} ,
{ field:
"glossy"
, title:
"Shining"
} ,
{ field:
"color"
, title:
"Color"
} ,
{ title:
""
, command:
"destroy"
, width:
"110px"
}
] ,
toolbar : [ { name:
"create"
, text :
"Add New Product"
} ,
"save"
,
"cancel"
],
detailTemplate: kendo.template($(
"#template"
).html()),
detailInit: detailInit,
sortable : {
mode :
"multiple"
,
allowUnsort :
true
} ,
editable : {
update :
true
, destroy :
true
, confirmation:
"really delete it? \n (press 'Save Changes' to delete it from server!)"
}
});
SELECT
`ID` , CONCAT(
name
,
' '
,
size
,
' '
, pages ,
' '
, weight ,
' '
, glossy ,
' '
, color )
AS
`product_name` ,
name
,
size
, pages , weight , glossy , color
FROM
fp_products;");