1

I have the following dropdown filter for datagrid, after i add data to grid, new category name appears in popup editor, but not in this dropdown, i have to reload to see new value in list :( How to do it in kendo way?

  $("#category_list").kendoDropDownList({
    dataTextField: "name",
    dataValueField: "name",
    dataSource: {
          transport: {
            read: {
              url: '/api/notes/cats',
              dataType: 'json',
              type: 'GET',
            },
          },
          schema: {
            data: function(reply) {
              return reply.rows
            },
          },
    },
    change: function() {
      val = $("#category_list").val();
      var grid = $("#grid").data().kendoGrid;
      grid.dataSource.filter({
        "filters":[{"field":"category","operator":"eq","value":val}]
      })
    },
    open: function() {
      var kd = $("#category_list").data().kendoDropDownList
      kd.dataSource.transport.read();
      console.log("reading")
    }
  })
4

2 回答 2

1

好的,就这么简单:

$("#category_list").data("kendoDropDownList").dataSource.read()

在打开。

于 2013-01-03T03:22:51.357 回答
0

这是旧 Q,但如果有人现在需要

    open: function () {
       this.dataSource.read();
       this.dataSource.filter({}); // This refreshes filter 
    }
于 2019-10-11T07:14:07.647 回答