or
$("#history_grid").kendoGrid({columns: [{ field: "type", title: "Document Type" },{ field: "entity", title: "To/From" },{ field: "date_received", title: "Date Sent/Received" },{ field: "path", title: " ", template: '<a href="${ path }">Link to file</a>', width: "80px" },{ command: { name: "ViewFile", text: "ViewFile", click: viewDoc }, title: " ", width: "100px" }],scrollable: true,autobind: false,dataSource: history_datasource});function viewDoc(e) {e.preventDefault();alert("Hello, world!");};
$(function() {
kendo.culture("es-ES");
var grid = $("#grid").kendoGrid({dataSource: {transport: {read: "datos_grid.php",create: {url: "datos_grid.php",type: "POST"},parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)}
}
}},schema: {data: "data",total: function(result) {
var data = this.data(result);
return data ? data.length : 0
},model: {id: "id",fields: {id: {validation: {required: true}},user_id: {validation: {required: true}},purchase_date: {validation: {required: true},type: "date"}}}},pageSize: 5,autoSync: true,batch: true},columns: [{title: "ID",field: "id",type: "text"}, {title: "Id Usuario",field: "user_id",type: "text"}, {title: "Fecha",field: "purchase_date",format: "{0:dd/MM/yyyy}"}, {command: ["edit", "destroy"],title: " ",width: "210px"}],pageable: {refresh: true,pageSizes: 5},toolbar: ["create", {template: kendo.template($("#template").html())}],editable: "inline"});
$("#category").keyup(function() {
var value = $(this).val();
if (value) {
grid.data("kendoGrid").dataSource.filter({logic: "or",filters: [{field: "id",operator: "contains",value: value}, {field: "user_id",operator: "contains",value: value}]})
} else {
grid.data("kendoGrid").dataSource.filter({})
}
})
});
grid.kendoGrid({ dataSource: { transport: { read: function(options) { options.success(filters); // filters is the local array of data }, create: function(options) { prime.dsCrud({ url: 'CreateFilters', crud: options }); }, update: function (options) { prime.dsCrud({ url: 'UpdateFilters', crud: options }); }, destroy: function(options) { prime.dsCrud({ url: 'DestroyFilters', crud: options }); }, parameterMap: function(options, operation) { console.log(operation); // *** never fires! *** } }, batch: true, pageSize: 10, schema: { model: { id: 'id', fields: { id: { editable: false, nullable: true }, member: { type: 'string', validation: { required: true } }, operator: { type: 'number', validation: { required: true } }, dataType: { type: 'string', validation: { required: true } }, value: { type: 'string', validation: { required: true } } } } } }, sortable: true, pageable: true, filterable: false, editable: true, navigatable: true, toolbar: ["create", "save", "cancel"], columns: [ { field: 'member', title: 'Column' }, { field: 'operator', title: 'Operator' }, { field: 'value', title: 'Value(s)' }, { command: 'destroy', title: '', width: '170px' } ]});prime.dsCrud = function (options) { $.ajax({ url: prime.data.queryTool + options.url, dataType: 'jsonp', contentType: 'application/json', type: 'POST', data: options.crud.data, success: function(data, textStatus, jqXHR) { options.crud.success(data); }, error: function(jqXHR, textStatus, errorThrown) { options.crud.error(jqXHR); }, complete: function(jqXHR, textStatus) { console.log('-----------------------------------'); console.log('response from ' + options.url + ':'); console.log(jqXHR); console.log('-----------------------------------'); } });}that._animations(options);
if (kendo.size(animation.effects)) {