filterWidgetCreating

filterWidgetCreating – This event is fired just before filter widget to be created. It helps you to pass additional options to each filter widgets. Passed parameters:

  • field – the name for the field to which the filter widget belongs
  • options– the options object passed as additional options of the filter widget
$(function () {
    $("#grid").shieldGrid({
        dataSource: {
            data: gridData,
            schema: {
                fields: {
                    id: { type: Number },
                    name: { type: String },
                    company: { type: String },
                    phone: { type: String },
                    age: { type: Number }
                }
            },
        },
        filtering: {
            enabled: true
        },
        paging: true,
        columns: [
            { field: "id", width: "250px", title: "ID" },
            { field: "name", title: "Person Name", width: "250px" },
            { field: "company", title: "Company" },
            { field: "phone", title: "Phone", width: "250px" },
            { field: "age", title: "Age" }
        ],
        events:
        {
            filterWidgetCreating: function (e) {
                if (e.field === "id") {
                    e.options = { max: 1000 };
                }
                if (e.field === "age") {
                    e.options = { min: 1 };
                }
            }
        }
    });
});