Have you tried : http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface-method-insertChild ? This takes an index parameter.
Extjs 4 treeStore appendChild after a specific node
Domanda
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()
}
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow