Thank you very very much. I really appreciate it.
You are a brilliant administrator
You are not logged in. Please login or register.
Mifjs forum — Mif.Tree, Mif.Menu » Help » Problem with toggle » Post new reply
All fields labelled (Required) must be completed before the form is submitted.
Thank you very very much. I really appreciate it.
You are a brilliant administrator
try with the latest code from trunk http://mifjs.net/trunk/tree/Download/index.html
try rewrite updateOpenState
Mif.Tree.Node.implement({ updateOpenState: function(){ this.drawToggle(); } });
I tried this but an error is appearing when I tried it:
"this.drawToggle is not a function"
try rewrite updateOpenState
Mif.Tree.Node.implement({
updateOpenState: function(){
this.drawToggle();
}
});Hi moro,
I don't really get a wrong state on the client.
My full code:
function create_ontology_tree(){
$('navigation').empty();
return new Mif.Tree({
container: $('navigation'),
expandTo : false,
initialize: function(){
new Mif.Tree.KeyNav(this);
new Mif.Tree.Drag(this, {
onComplete: function(){
Request(
'../CopyCatchword.do',
{
'catchWordID' : this.current.data.catchWordID
}
);
}
});
},
dfltType:'folder',
height: 18
})
.load({
url: "../GetJson.do"
})
.addEvent('select',function(node){
Request(
'../SelectCatchword.do',
{ 'catchWordID' : node.data.catchWordID}
);
})
.addEvent('toggle',function(node, state){
Request(
'../Toggle.do',
{ 'catchWordID' : node.data.catchWordID }
);
});
}the request function is of course a function of mine.
The problem is now that when I load the json String he always calls the toggle function for every open node in the json. I dont want him to do that.
The toggle function
.addEvent('toggle',function(node, state){
Request(
'../Toggle.do',
{ 'catchWordID' : node.data.catchWordID }
);
});should only be called when the user toggles a catchword on the tree. But in the moment this function is even called when I load a new json for every node in the json with: "state":{ "open":true }.
But I don't want that to happen!!!
Now you understand my problem moro??
Or still not?:)
don't understand how you get wrong state, mb you missed if(state) check:
.addEvent('toggle',function(node, state){
if(state){
put request
}full code pls.
nobody there, who can help me???Even moro???
Good Evening,
I have got currently a problem with the toggle function.
I have got a client server application. The server shall memorize the state of the tree, that means which node is open and which is not.
When the user toggles a node, i post to the server which node has been toggled like this:
.addEvent('toggle',function(node, state){
treeRequestPut(
'../Toggle.do',
{ 'catchWordID' : node.data.catchWordID}
);When I now request a new tree from the server I get a right Json String back from the server. The JsonString includes the nodes which are open:
"property":{"name":"Test"},
"data":{"catchWordID":"1"},"state":{ "open":true }.
I get the json from a certain url and I call this url from the load function like this:
.load({
url: "../GetJson.do
})Right to this moment, evertythig is okay, so no problem.
The problem is now when i load the new jsonString in the load function that he always calls the toggle function again for every open node!
That's the reason why i get wrong states for the nodes on the server.
Is there a chance to prevent that he always calls the toggle function from the beginning??
Please apoligize for my bad english,
when anything is unclear or if you want to see my whole code please tell me.
I really need some help beacause I really need to solve this problem.
Best Jonathan
Mifjs forum — Mif.Tree, Mif.Menu » Help » Problem with toggle » Post new reply
Powered by PunBB