Question

I have Object Name Roption and I want to remove third element inside Add Task.

This one => "{ text: "Child", alias: "addsubbelowchild", action:menuAction}"

I am using Delete Roption.items[0].items[2].

It works but Roption.items[0].items.length returns the same count number even after deleting.

Is it really deleting or just making it undefined?

 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) {}
Was it helpful?

Solution

Try using .splice(index,howmany)

Roption.items[0].items.splice(2,1);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top