【问题标题】:Kendo UI Grid update all rows with the selected column valueKendo UI Grid 使用选定的列值更新所有行
【发布时间】:2015-02-04 09:16:59
【问题描述】:

我为我的一个网格设置了 ctrl 点击功能,用户可以在其中按住 ctrl,从下拉编辑器中为单元格进行选择,我希望它使用该选择更新模型中的所有数据,不只是那一行。

我该怎么做?

var R = this;
            $('<input required data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoDropDownList({
                    autoBind: false,
                    dataTextField: "condition",
                    dataValueField: "conditionId",
                    dataSource: config.filters.conditions,
                    close: function () {
                        if (R.ctrlDown) {
                            // Update all rows here somehow....
                            R.data('kendoGrid').dataSource.read();
                        }
                    }
                });

【问题讨论】:

    标签: jquery kendo-ui kendo-grid kendo-datasource


    【解决方案1】:

    你可能需要这样的东西:

    // Update all rows here somehow....
    R.find(".k-state-selected").each(function (item) {
        R.data("kendoGrid").dataItem(this).value = theSelectedValue;
    });
    // possibly do something to persist the data here
    

    这将遍历网格中所有选定的行。

    dataItem(HTMLelement) 将为您提供包含您想要更改的所有详细信息的 dataSource 项(.value 就是一个示例)。

    对于剑道 UI,我不是专业人士,而是初学者,但我最近也在编写这些代码,所以这段代码可能会给您带来新的想法。 要了解更多详细信息,我现在没有时间并且对您的其余代码没有足够的了解;)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-19
      • 1970-01-01
      • 2012-12-05
      • 1970-01-01
      • 2017-10-26
      • 2013-10-06
      相关资源
      最近更新 更多