Giter VIP home page Giter VIP logo

Comments (9)

mbraak avatar mbraak commented on August 15, 2024

Sounds like a bug. I will look into it.

from jqtree.

mbraak avatar mbraak commented on August 15, 2024

I cannot reproduce the error.

Do you use 'getselectednode' or 'getSelectedNode'?

from jqtree.

 avatar commented on August 15, 2024

this is my code :

function OnStartPage() {
var mydiv = $("#mydiv");

$.getJSON(
        "mypage.aspx",
        function (data) {
            if ("" == mydiv[0].innerHTML) {
                mydiv.tree({
                    data: data,
                    autoOpen: false,
                    dragAndDrop: false,
                    selectable: true,
                    saveState: "mytreeview"
                });
            }
            else {
                mydiv.tree('loadData', data);
            }
        }
);

var node = mydiv.tree('getselectednode');

// result : node is null

}

from jqtree.

mbraak avatar mbraak commented on August 15, 2024

I think you should call 'getSelectedNode' after loading the data. Like this:

$.getJSON(
        "mypage.aspx",
        function (data) {
            if ("" == mydiv[0].innerHTML) {
                mydiv.tree({
                    data: data,
                    autoOpen: false,
                    dragAndDrop: false,
                    selectable: true,
                    saveState: "mytreeview"
                });
            }
            else {
                mydiv.tree('loadData', data);
            }

            var node = mydiv.tree('getSelectedNode');
        }
);

I hope this works.

from jqtree.

 avatar commented on August 15, 2024

i tried but node is still null.

from jqtree.

medouederni avatar medouederni commented on August 15, 2024

it work with 'getSelectedNode'

from jqtree.

limmouyleng avatar limmouyleng commented on August 15, 2024

I also got problem with 'getSelectedNode' . It returns "false" for the first time of select. But what I prefer is i want to get the node that i select. Any help?

from jqtree.

mbraak avatar mbraak commented on August 15, 2024

Hello Limmouyleng,

In which situation exactly does getSelectedNode return false? Are you using the saveState option or are you selecting a node by clicking on it?

Greetings

from jqtree.

limmouyleng avatar limmouyleng commented on August 15, 2024

Hi mbraak,

I solved this problem by using " $(document).delegate('#tree', 'click', function() {}) " . But the previous problem is when i used "onclick in

" and it returns false for the first click.

from jqtree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.