目前我使用window.operateEvents
作为data-events
作为bootstrap-table columns
之一。我想将其拆分为多个文件以获取权限。然后只加载需要加载的内容。
现在可以使用,但我正在合并两个objects properties
。 property
property
。这是最快/最好的方式吗?
还有一种方法可以让这项工作完全没有结合objects
bootstrap-table
会更好地认识到这两个/**
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1
* @param obj1
* @param obj2
* @returns newObj a new object based on obj1 and obj2
*/
function merge_options(obj1,obj2){
// If object1 doesn't exist just give back obj2
if(typeof(obj1) === "undefined" ){
return obj2;
}
var newObj = {};
for (var attrname in obj1) { newObj [attrname] = obj1[attrname]; }
for (var attrname in obj2) { newObj [attrname] = obj2[attrname]; }
return newObj;
}
/**
* @brief operator events for actions on the rows
* @type void
*/
window.operateEvents = merge_options(window.operateEvents,{
'click .edit': function(e,value,row,index){
requestConfirm(e,value,row,"update",
function(){
$('#table').bootstrapTable('refresh', "{silent: true}");
}
);
e.stopPropagation();
}
});
/** Add delete functionality */
window.operateEvents = merge_options(window.operateEvents, {
'click .remove': function(e,value,row,index){
requestConfirm(e,value,row,"delete",
function(){
$('#table').bootstrapTable('refresh', "{silent: true}");
}
);
e.stopPropagation();
}
});
吗?
library(plyr)
ldply(df.lst,data.frame)
.id a b d e f g
1 A 1 5 2 1 1 1
2 A 2 4 3 1 2 2
3 B 1 3 2 NA NA NA
4 B 2 2 3 NA NA NA
5 C 1 4 1 1 NA NA
6 C 2 3 2 3 NA NA
答案 0 :(得分:1)
执行此操作的最佳方法是按属性名称开始向operationEvents对象添加每个操作。
例如:
100
希望这有帮助。