How to append a child on a specific position (as default the new child will appear after the last node)
如何在特定的位置上附加一个子节点(默认情况下,新子节点将出现在最后一个节点之后)
My solution is to use a variable of order
我的解决方法是使用一个变量的顺序。
function treeGridReorder(){
var i=0 ,j = 0;
treeGrid.getView().getStore().each(function(node){
node.data.ordre=i;
j=0;
node.eachChild(function(cnode){
cnode.data.ordre=j;
j++;
});
i++;
})
}
function add_reponse(quest, qIndex){
questStr.sort('ordre', 'ASC');
var now=new Date().getTime();
questStr.getNodeById(quest).appendChild({id:now, libelle:'Nouvelle réponse',parentq:quest, saved:false, leaf: true});
treeGridReorder()
}
1 个解决方案
#1
1
Have you tried : http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface-method-insertChild ? This takes an index parameter.
您是否尝试过:http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface-method-insertChild ?这需要一个索引参数。
#1
1
Have you tried : http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface-method-insertChild ? This takes an index parameter.
您是否尝试过:http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface-method-insertChild ?这需要一个索引参数。