Hello,
Im trying to create a custome filter but this never pass to my controller some field that have the filter name
I create a function that initialize the Grid
Its ok, work fine but i can send filters ... my logic is create a filter and under the filter show the grid
I have this HTML
And for initialize the grid i only need to use this
Im trying to create a custome filter but this never pass to my controller some field that have the filter name
I create a function that initialize the Grid
function KendoUIGrid(config){ var grid = $("#" + config.id); grid.kendoGrid({ columns: config.columns, dataSource: { transport: { read: { url: config.url, dataType: "JSON", type: "POST", data: { action: 'read' } }, //destroy: { // url: config.url, // dataType: "JSON", // type: "POST", // data: { // action: 'destroy' // } //}, //update: { // url: config.url, // dataType: "JSON", // type: "POST", // data: { // action: 'update' // } //}, //create: { // url: config.url, // dataType: "JSON", // type: "POST", // data: { // action: 'create' // } //}, parameterMap: function (options) { var result = { page: options.page, pageSize: options.pageSize, skip: options.skip, orderBy: '', take: options.take, pi: options.page == 1 ? 1 : options.skip + 1, pf: options.skip + options.take, action: options.action }; if (options.sort != undefined) { if (options.sort[0] != undefined) { result.orderBy = options.sort != undefined ? options.sort[0]['field'] + ' ' + options.sort[0]['dir'] : ''; } else { result.orderBy = 1; } } return result; } }, schema: { total: "total", data: "data" }, pageSize: 15, serverSorting: true, serverPaging: true, severFiltering: true }, sortable: true, resizable: true, pageable: { numeric: false, input: true }, selectable: true });I have this HTML
<h2>Proveedores</h2><div class="box k-shadow"> <div id="grid"> <div class="k-block"> <div class="k-header">Filtro de búsqueda</div> <table> <tr> <td> <input type="text" name="nombre" placeholder="Ingrese el nombre del proveedor" class="k-textbox" /> </td> <td style="width:100px;"> <select> <option>Activo</option> <option>Inactivo</option> </select> </td> </tr> <tr> <td colspan="2"> <button class="k-button">Limpiar</button> <button id="btnFiltrar" class="k-button">Filtrar</button> </td> </tr> </table> </div> </div></div$(document).ready(function () { var config = { id: 'grid', url: BaseUrl('mantenimiento/ProveedorGrid'), columns: [ { field: "id", title: "id", width: 50, hidden: true }, { field: "nombre", title: "Nombre" }, { command: [ {template: KendoUILinkButton(BaseUrl('mantenimiento/proveedor'), 'edit')}, {template: KendoUILinkButton(BaseUrl('mantenimiento/ProveedorGrid'), 'delete')} ], width: 88 } ] }; KendoUIGrid(config); $("#btnFiltrar").click(function () { $("#grid") .data("kendoGrid") .dataSource.filter({ filters: [ { field: "nombre", operator: "startswith", value: "Paul" } ] }); })})