moris62
moris62

Reputation: 1045

filter data after ajax call using kendo ui

In the following ajax call,i have data in result,now i want to filter my result:

      $.ajax({
          dataType: "json",
          type: "POST",
          url: "@Url.Action("method", "controller")",
          contentType: "application/json; charset=utf-8",
          data: JSON.stringify({ "regionalManager": dtDrpVals.drpValue}),
          success: function (result) {       
              var rst = new kendo.data.DataSource({
              data: result,
              filter: [
    { field: "presented_in_class", operator: "eq", value: "false" },
    { field: "passed_course", operator: "eq", value: "false" }
          ]
      });          

is the way i should filter ajax call?if so,why the filter is not working,i still get the same data

Upvotes: 1

Views: 247

Answers (1)

Richard
Richard

Reputation: 27536

The configuration property filter value is either

  • a single filter clause, or
  • a composite filter clause

A single filter clause is an object with three properties

  • field
  • operator
  • value

A composite filter clause is an object with two properties

  • logic, "and" or "or"
  • filters, an array of filters to be evaluated conjunctively using the logic value
    • the filters can be any mix of single or composite filters.

If logic is not specified it will default to "and".

I presume the top level configuration filter: value is specially examined. If the value is an array, the value will be considered a composite filter with logic and

The composite form allows nested logic such as ( A or (B and C) or (D and (E or F)) )

Upvotes: 1

Related Questions