2

Webix Datatable でボタン テンプレートを次のように定義しました。

    grid = new webix.ui({
                container: "permissions",
                view: "datatable",
                columns: [
                    { id: "Id", adjust: "data", header: "&nbsp;", template: "<button value='#Id#' class='btn btn-warning btn-xs edit'><i class='glyphicon glyphicon-pencil'></i></button> <button value=#Id# class='btn btn-danger btn-xs'><i class='glyphicon glyphicon-trash'></i></button>" }
                    ...Other columns here
 }
                ],
                pager: {
                    container: "paging_here",
                    size: 10,
                    group: 5
                },
                autoheight: true,
                minHeight: 50,
                autowidth: true,
                on: {
                    onBeforeLoad: function () {
                        this.showOverlay("Загрузка данных...");
                    },
                    onAfterLoad: function () {
                        this.hideOverlay();
                    }
                },
                url: "" + _args[0] + ""
            });

残念ながら、ボタン テンプレートで定義された属性の値を取得する方法がわかりません。私はそのようなことを試みますが、うまくいきません:

grid.on_click.edit = function (e, id, trg, value) {
                //Core.init(["../Permissions/Edit/?id=" + e.Id]);
                //Core.loadModal();
                alert($(this).attr("value"));
                return false;
            };
4

1 に答える 1

0

答えが出ました。その通りです。

grid.on_click.edit = function (e, id, trg, value) {
    alert(grid.getItem(id).Id); //Where Id is value binded in column
    return false;
};
于 2016-02-20T07:10:03.663 に答える