Webix作为Vue的调用方式
Webix as Vue call method
如何从 Webix 部分调用事件 onAfterDrop
中的方法 storeNewOrder
?
this.$emit.storeNewOrder()
和 storeNewOrder()
不起作用
export default {
template:"<div></div>",
props:
['url'],
computed: mapGetters({
}),
mounted:function(){
this.webixId = webix.ui({
container: this.$el,
$scope: this,
view:"treetable",
height: 600,
id: 'project',
headermenu: true,
resizeColumn: true,
select: "row",
dragColumn:true,
headerRowHeight:40,
drag:true,
columns: [
{id: "order_column",header:"Id", width: 50, sort: "int"},
{id: "value", header:"Bezeichnung",fillspace: true, minWidth: 200, sort: "string", template:"{common.treetable()} #value#" },
{id:"created_at", map:"(date)#created_at#", header:["Erstellt am", { content:"dateRangeFilter"}], adjust: true },
],
on: {
onSelectChange: function(){
store.commit('setSelectedPart', this.getItem(this.getSelectedId(true)))
},
onItemDblClick: function () {
store.commit('setPartView', 'detail')
},
onAfterLoad: function () {
if (selectedRowId) {
this.select(selectedRowId)
this.showItem(selectedRowId)
}
},
onAfterDrop: function(context, native_event){
storeNewOrder() //how to call the method storeNewOrder?
}
},
url: this.url
})
},
methods: {
storeNewOrder: function() {
//store new order
}
},
destroyed:function(){
webix.$$(this.webixId).destructor();
}
}
你应该用 this.storeNewOrder()
调用它,但我怀疑它可能超出范围。
所以在 mounted
函数的顶部执行:
const self = this;
this.webixId = webix.ui({
...
然后用self.storeNewOrder()
调用
两种方法都试试。
如何从 Webix 部分调用事件 onAfterDrop
中的方法 storeNewOrder
?
this.$emit.storeNewOrder()
和 storeNewOrder()
不起作用
export default {
template:"<div></div>",
props:
['url'],
computed: mapGetters({
}),
mounted:function(){
this.webixId = webix.ui({
container: this.$el,
$scope: this,
view:"treetable",
height: 600,
id: 'project',
headermenu: true,
resizeColumn: true,
select: "row",
dragColumn:true,
headerRowHeight:40,
drag:true,
columns: [
{id: "order_column",header:"Id", width: 50, sort: "int"},
{id: "value", header:"Bezeichnung",fillspace: true, minWidth: 200, sort: "string", template:"{common.treetable()} #value#" },
{id:"created_at", map:"(date)#created_at#", header:["Erstellt am", { content:"dateRangeFilter"}], adjust: true },
],
on: {
onSelectChange: function(){
store.commit('setSelectedPart', this.getItem(this.getSelectedId(true)))
},
onItemDblClick: function () {
store.commit('setPartView', 'detail')
},
onAfterLoad: function () {
if (selectedRowId) {
this.select(selectedRowId)
this.showItem(selectedRowId)
}
},
onAfterDrop: function(context, native_event){
storeNewOrder() //how to call the method storeNewOrder?
}
},
url: this.url
})
},
methods: {
storeNewOrder: function() {
//store new order
}
},
destroyed:function(){
webix.$$(this.webixId).destructor();
}
}
你应该用 this.storeNewOrder()
调用它,但我怀疑它可能超出范围。
所以在 mounted
函数的顶部执行:
const self = this;
this.webixId = webix.ui({
...
然后用self.storeNewOrder()
两种方法都试试。