1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 17:24:06 +08:00

opt onaction

This commit is contained in:
shylinux 2021-04-13 14:40:03 +08:00
parent 9c0968eab9
commit bf16642bd2
2 changed files with 9 additions and 9 deletions

View File

@ -334,9 +334,9 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
table.onimport && table.onimport._init && table.onimport._init(table, msg, msg.result||[], function(msg) { table.onimport && table.onimport._init && table.onimport._init(table, msg, msg.result||[], function(msg) {
can.page.Modify(can, can._action, ""), can.page.Modify(can, can._status, "") can.page.Modify(can, can._action, ""), can.page.Modify(can, can._status, "")
table.onaction && table.onappend._action(table, msg._action||meta._action||table.onaction.list) table.onaction && table.onappend._action(table, can.base.Obj(msg.Option("_action"), meta._action||table.onaction.list))
table.ondetail && table.onappend._detail(table, msg._detail||meta._detail||table.ondetail.list) table.ondetail && table.onappend._detail(table, can.base.Obj(msg.Option("_detail"), meta._detail||table.ondetail.list))
table.onexport && table.onappend._status(table, msg._export||meta._export||table.onexport.list) table.onexport && table.onappend._status(table, can.base.Obj(msg.Option("_status"), meta._export||table.onexport.list))
}, can._output) }, can._output)
}) })
}) })
@ -421,8 +421,8 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
}, },
table: function(can, msg, cb, target, sort) { table: function(can, msg, cb, target, sort) {
var table = can.page.AppendTable(can, msg, target||can._output, msg.append, cb||function(value, key, index, line, array) { var table = can.page.AppendTable(can, msg, target||can._output, msg.append, cb||function(value, key, index, line, array) {
if (key == "value") { key = line.key, line = {} if (key == "value") { key = line.key||line.name, line = {}
can.core.List(array, function(item, index) { line[item.key] = item.value }) can.core.List(array, function(item, index) { line[item.key||line.name] = item.value })
} }
return {type: "td", inner: value, onclick: function(event) { var target = event.target return {type: "td", inner: value, onclick: function(event) { var target = event.target

View File

@ -7,25 +7,25 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can.page.Append(can, target, [can.onimport._control(can, msg)]) can.page.Append(can, target, [can.onimport._control(can, msg)])
can.onappend.table(can, msg, function(value, key, index, line, array) { can.onappend.table(can, msg, function(value, key, index, line, array) {
return can.onimport._table(can, value, key, index, line, array) return can.onimport._table(can, value, key, index, line, array, cb)
}) })
can.onappend.board(can, msg.Result()) can.onappend.board(can, msg.Result())
can.onmotion.story(can, can._output) can.onmotion.story(can, can._output)
}, },
_table: function(can, value, key, index, line, array) { _table: function(can, value, key, index, line, array, cb) {
return {text: [value, "td"], onclick: function(event) { var target = event.target return {text: [value, "td"], onclick: function(event) { var target = event.target
if (target.tagName == "INPUT" && target.type == "button") { var msg = can.sup.request(event, can.Option()) if (target.tagName == "INPUT" && target.type == "button") { var msg = can.sup.request(event, can.Option())
key == "value"? can.core.List(array, function(item, index) { msg.Option(item.key, item.value) }): msg.Option(line) key == "value"? can.core.List(array, function(item, index) { msg.Option(item.key, item.value) }): msg.Option(line)
return can.run(event, ["action", target.name], function(msg) { can.run() }, true) return can.run(event, ["action", target.name], function(msg) { can.run() }, true)
} }
if (can.sup.onaction.change(event, can.sup, key, value, function(msg) { can.onimport._init(can, msg) }).length > 0) { return } if (can.sup.onaction.change(event, can.sup, key, value, function(msg) { can.onimport._init(can, msg, [], cb) }).length > 0) { return }
}, ondblclick: function(event) { }, ondblclick: function(event) {
can.onmotion.modify(can, event.target, function(event, value, old) { can.onmotion.modify(can, event.target, function(event, value, old) {
var msg = can.sup.request(event, can.Option()); msg = can.sup.request(event, line) var msg = can.sup.request(event, can.Option()); msg = can.sup.request(event, line)
can.run(event, ["action", "modify", key == "value"? line.key: key, value], function(msg) { }, true) can.run(event, ["action", "modify", key == "value"? line.key||line.name: key, value], function(msg) { }, true)
}) })
}} }}
}, },