EasyUI Forum
June 16, 2024, 01:43:01 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: 1 [2] 3
16  General Category / EasyUI for jQuery / Re: Expand event doesn't fire every time on: September 05, 2014, 11:25:26 AM
I have always the same problem with onExpand in a tree.
It takes 3 clisk to have the call of the method.

The html code is:
Code:
    <div id="cc" class="easyui-layout">
      <div id="west" data-options="region:'west',title:'Régates',split:true">
  <ul id="treev" class="easyui-tree" data-options="animate:true,checkbox:true">
           </ul>
      </div>
     <div id="center" data-options="region:'center',title:'Carte'"></div>
  
     <div data-options="region:'south',title:'Log'">
     <div id="sud" class="easyui-layout" data-options="fit:true">
     <div id="log" data-options="region:'center',border:false"></div>
     <div id="status" data-options="region:'south'">
                    <table class="statusTable">
                        <tr>
                            <td><div id="mode">Mode:</div></td>
                            <td><div id="regate">Régate:</div></td>
                            <td>Dernière mesure:</td>
                            <td></td>
                            <td>Heure:</td>
                        </tr>
                    </table>
</div>
</div>
     </div>
    </div>

maybe , the problem comes from there ?

Look at the http://jsfiddle.net/n28905u1/9/
To add data2 to the tree (onExpand method), you have to click 3 times on the first node !
17  General Category / EasyUI for jQuery / Re: Expand event doesn't fire every time on: May 12, 2014, 10:14:41 AM
Effectively your code is OK.

I have to verify my HTML declaration , maybe, there is a problem in this part of code.
I 'll give you some information about .
Thanks
18  General Category / EasyUI for jQuery / Re: tree getChildren blocks my code on: May 11, 2014, 09:55:11 AM
Thanks sworty to answer me on sunday !

I tried hasNode method on the selected node but it doesn't give me any value, neither 0 or false, neither true or a value, so I prefer use the method with getfolders which is OK in my code.
19  General Category / EasyUI for jQuery / Re: tree getChildren blocks my code on: May 11, 2014, 08:01:14 AM
Finally, I adapt this answer http://www.jeasyui.com/forum/index.php?topic=1951.msg4306;topicseen#msg4306
to determine if I have or not sub folder at a level of my tree.

I don't change the extend function but I change the code after the call method
Code:
var folders = J('#treev').tree('getFolders', node.target);
 
 if(folders.length ==0) // if 0 then there isn't any subfolders for this node
 {
...
 }

20  General Category / EasyUI for jQuery / Re: tree getChildren blocks my code on: May 11, 2014, 07:04:33 AM
Hi sworthy.

I tried
Code:
var isLeaf = $('#tt').tree('isLeaf', node.target);

It gives to me a "false value" all the time even if the node has children ! I think it's normal because , all my nodes are folders and not leaf (at this time).

I explain my problem again, because I think you don't understand it the first time.
I want to modelize in a tree some REGATE (first level of folder) which contains some GROUP (second level of folder) which contain some CONTACT (third level of folder) which contain some GPSPOINTS( leaves at the fourfth level).

As I can have a lot of objects to show in my tree, I load data only for the branch user selects it one level by one level.

Initialy, I have a empty tree. I load by an ajax request the REGATE as first folder (but not these sub contents).
When then I click to expand a folder REGATE, I execute an other ajax request to load the content (the GROUPS) et show it (but not these sub contents).
When I click to expand a folder GROUP,  I execute an other ajax request to load the content (the CONTACTS) et show it (but not these sub contents).
And to finish , when I click to expand a folder CONTACT,  I execute an other ajax request to load the content (GPSPOINTS) as leaves.

So when I select a level of the tree, I have to know if the data is already loaded or not to forbide two identical loads. And I think that the method to know if the node has a child folder ou children folder is the good.

Sorry for the long explain, but maybe it's clearly for you Sworty ?
Finally how to determine if a folder node has folder children ?

Thanks.
Cyril
21  General Category / EasyUI for jQuery / Re: Expand event doesn't fire every time on: May 11, 2014, 06:09:55 AM
The behaviour is the same when I remove requeteNoeud(node).
The alert method is only called the third time I click on the little triangle to develop or close the tree
22  General Category / EasyUI for jQuery / Re: tree getChildren blocks my code on: May 09, 2014, 09:16:52 PM
Ok sworthy, but I want to detect subdirectory in my tree and isLeaf method gives me FALSE even if I have subdirectories in my tree.
I 'm looking for a test to detect all type of children (directories or leaves) in my tree .
23  General Category / EasyUI for jQuery / Re: Expand event doesn't fire every time on: May 09, 2014, 09:07:33 PM
My code is the same. I don't think it's a syntax problem.

I add an alert(..) in the onExpand function and I get the same behaviour. Only the third click is taken acount and function is called.

I think the problem is a conflict with other function on the tree on my code, but which is ?

Here is the others functions:

Code:
 J('#treev').tree({ // charge les tooltips adaptés à partir de l'attribut
            formatter:function(node){
                return '<span title="' + node.attributes.info + '">' + node.text + '</span>';
            }
        });
        J('#treev').tree({ // appel du plugin
            onClick:function(){
                var nodes = J('#treev').tree('getChecked');
                var s = '';
                for(var i=0; i<nodes.length; i++){
                        if (s != '') s += ',';
                        s += nodes[i].id;
                }s
                alert(s);
            }
        });
        J('#treev').tree({
            onCheck:function(node,checked){
               if(checked) alert(node);
            }
        });
        // On sélectionne l'ouverture d'un noeud dans l'arborescence
        J('#treev').tree({
            onExpand:function(node){
               alert('expand node '+node.text);
               requeteNoeud(node);
            }
        });
        // Extension de méthode pour implémenter une fonction removeAll dans le tree
        J.extend(J.fn.tree.methods, {
            removeAll:function(jq){
return jq.each(function(){
var roots = J(this).tree('getRoots');
for(var i=0; i<roots.length; i++){
J(this).tree('remove', roots[i].target);
}
})
            }   
        })

24  General Category / EasyUI for jQuery / Expand event doesn't fire every time on: May 09, 2014, 01:30:13 PM
I have this method on a tree

  J('#treev').tree({
            onExpand:function(node){
               requeteNoeud(node);
            }
        });

My function "requeteNoeud(node); " is only called after 3 clicks on the directory of the tree.

First, I expand with the mouse. None event onExpand is fired
Second, I de-expand with the mouse, none event onExpand  is fired
Third, I expand again with the mouse and then the event onExpand is fired !

Is it normal ?
25  General Category / EasyUI for jQuery / tree getChildren blocks my code on: May 09, 2014, 01:24:14 PM
I have a code with a treeview with some objects inside.
When I want to know If a node has some child, with this code
 
function requeteNoeud(node)
 {
  
  var childNodes=J('#treev').tree('getChildren',node.target);
  if(childNodes.length >0) alert("some children");


my code blocks on the first line of the function and I have this error

TypeError: data is undefined

for(var i=0;i<data.length;i++){

jquery....min.js (ligne 1907)

The code in jquery is:
function _108(data,_163){
var _164=[];
for(var i=0;i<data.length;i++){
_164.push(data);
}
and the line in error is: for(var i=0;i<data.length;i++){

Is someone could help me ?
26  General Category / EasyUI for jQuery / Re: How to remove all the nodes of a tree on: May 09, 2014, 10:12:31 AM
Thank you very much sworthy
27  General Category / EasyUI for jQuery / How to remove all the nodes of a tree on: May 09, 2014, 08:45:42 AM
Hello
How to remove all the nodes of tree (like a clear method for example)?

There is the remove function but it's for ONE node whose you know already the 'id', but if you don't know what nodes are inside the tree, how to do ?

Thanks for your help.
28  General Category / EasyUI for jQuery / Re: Numbering the id of a treeview on: April 27, 2014, 12:49:53 PM
Is someone has an idea for my problem for numbering the treeview elements ?
29  General Category / EasyUI for jQuery / Re: Is it possible to have tooltip on leaves or branches of a tree ? on: April 06, 2014, 09:05:54 AM
Excellent, thanks Sworthy.
May I use node.attributes to store the string for the tooltip when I create the tree with an array ?
Then I use your code modified
Code:
return '<span title="' + node.attributes+ '">' + node.text+ '</span>';

Question: can node.attributes store an array to store many informations on a branch of the tree ?
30  General Category / EasyUI for jQuery / Re: How to use loadData for a tree with data contained in a variabble on: April 06, 2014, 08:53:11 AM
I have found a solution. I must add bracket around data
Code:
   J('#treev').tree('loadData', [data]);

With this bracket, it's OK. Strange ?
Pages: 1 [2] 3
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!