개체 이름이 Roption
이고 작업 추가에서 세 번째 요소를 제거하고 싶습니다.JavaScript 개체에서 요소를 제거하는 방법
이것은 => I가 가 Roption.items 삭제 사용하고 "{ text: "Child", alias: "addsubbelowchild", action:menuAction}"
[0] .items [2]를.
작동하지만 Roption.items [0] .items.length는 삭제 후에도 동일한 카운트 수를 반환합니다.
정말 삭제되었거나 정의되지 않았습니까?
var Roption = { width: 150, items: [
{ text: "Add Task", alias: "addtask", type: "group" , width : 130 , items :
[
{ text: "Sibling", alias: "addsiblingbelow", action : menuAction},
{ text: "Child First", alias: "addsubaboveDirect", action: menuAction },
{ text: "Child Last", alias: "addsubbelowDirect", action: menuAction },
{ text: "Child", alias: "addsubbelowchild", action:menuAction},
{ text: "Advanced Add", alias: "advancedadd", type: "group" , width : 120 , items :
[
{ text: "Sibling", alias: "addsibling", type: "group" , width : 120 ,items :
[
{ text: "Below", alias: "addsiblingbelow", action: menuAction },
{ text: "Above", alias: "addsiblingabove", action: menuAction }
]
},
{ text: "Child", alias: "addsubtask", type: "group" , width : 120 ,items :
[
{ text: "First", alias: "addsubabove", action: menuAction },
{ text: "Last", alias: "addsubbelow", action: menuAction }
]
}
]
}
]
}
]
, onShow: applyrule
, onContextMenu: BeforeContextMenu
, onClose : AfterContextMenu
};
function menuAction(row) {}
function BeforeContextMenu(row) {}
function applyrule(row) {}
function AfterContextMenu(row) {}
를 사용하려고하면 splice' 방법 –
@Anton은 True를 반환 ... –
@IgorDymov가 실제로 작동 ...하지만 스플 라이스를 삭제'사용할 수 있습니다 배열 프로토 타입에서 작동합니다 ... 그리고 그 객체 .. 내가 잘못하면 나를 정정하십시오 !! - –