编辑列raise`无法读取属性'$总和';未定义的`、Webix DataTable和Firebase的
我试图使用Webix DataTable编辑Firebase上的记录,并通过数学运算计算两条记录的总和 这是我的数据表的一部分:编辑列raise`无法读取属性'$总和';未定义的`、Webix DataTable和Firebase的,firebase,webix,Firebase,Webix,我试图使用Webix DataTable编辑Firebase上的记录,并通过数学运算计算两条记录的总和 这是我的数据表的一部分: view:"datatable", id:"clientTable", select:true, multiselect:true, editable:true, editaction:"click", math: true, footer:true, columns:[ { id:"index", header:"#", sort:"int", adj
view:"datatable",
id:"clientTable",
select:true,
multiselect:true,
editable:true,
editaction:"click",
math: true,
footer:true,
columns:[
{ id:"index", header:"#", sort:"int", adjust:"data"},
{ id:"date", header:"Fecha", sort:"date", editor:"date", fillspace:true, adjust:"data", format:webix.Date.dateToStr("%d/%m/%y"), adjust:"data"},
{ id:"title", header:[ "Producto",{content:"textFilter"}], sort:"string", editor:"text", fillspace:true },
{ id:"bill", header: "Fractura", sort:"int", editor:"text", fillspace:true, text:"0"},
{ id:"amount", header: "Importe", sort:"int", editor:"text", fillspace:true, text:"0"},
{ id:"paid", header: "Pagado", sort:"int", editor:"text", fillspace:true, text:"0"},
{ id:"sum", header:"Suma", math:"[$r,amount] - [$r,paid]"}], //, cssFormat: mark_sum , footer:{content:"summColumn"}
rules:{
"title": webix.rules.isNotEmpty,
"bill": webix.rules.isNotEmpty,
"amount": webix.rules.isNotEmpty,
"paid": webix.rules.isNotEmpty,
"sum": webix.rules.isNotEmpty,
"bill": webix.rules.isNumber,
"amount": webix.rules.isNumber,
"paid": webix.rules.isNumber,
"sum": webix.rules.isNumber,
"bill": function(value){ return value > 0 },
"amount": function(value){ return value > 0 },
"paid": function(value){ return value >= 0 },
"sum": function(value){ return value >= 0 }
},
在我尝试编辑amount
或paid
之前,一切都很顺利,这些都是在sum
列中计算的。在使用Math
函数进行编辑时,我似乎有一个竞争条件
例外情况是:
Uncaught TypeError: Cannot read property '$sum' of undefined
at h.jn (webix.js:1103)
at h.jn (webix.js:1104)
at h.gn (webix.js:1102)
at webix.DataStore.<anonymous> (webix.js:13)
at webix.DataStore.callEvent (webix.js:23)
at webix.DataStore.updateItem (webix.js:524)
at h.updateItem (webix.js:545)
at h.ri (webix.js:790)
at h.<anonymous> (webix.js:788)
at h.si (webix.js:1115)
Uncaught TypeError:无法读取未定义的属性“$sum”
在h.jn(webix.js:1103)
在h.jn(webix.js:1104)
at h.gn(webix.js:1102)
在webix.DataStore。(webix.js:13)
位于webix.DataStore.callEvent(webix.js:23)
位于webix.DataStore.updateItem(webix.js:524)
在h.updateItem(webix.js:545)
在h.ri(webix.js:790)
在h。(webix.js:788)
在h.si(webix.js:1115)
是否有办法使总和仅在编辑后计算?或者避免在未定义的属性上计算此总和
我曾尝试将默认值放在这些列上,但根本没有帮助
谢谢。在@George comment之后,由于firebase的更改,$不能用作firebase密钥的前缀,因此webix math无法使用它
一个解决方法是使用firebase事务并自己进行计算。
$
已从最新的firebase更新中删除+您必须添加更多代码以了解您是什么trying@george$
是webix数学函数的一部分。我无法避免itok sry。但是,对于新的firebase项目,美元是不受支持的