Welcome Guest Search | Active Topics | Sign In | Register

Treeview and checkbox Options
Samuele
Posted: Tuesday, January 27, 2009 6:00:39 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 58
Hi,

i'm using a treeview with checkbox and i don't be able to raise a callback when press on checkbox..
i've try to set RaisesServerEvent property but callback is raised only when i press on item text.

Thanks
Paroca
eo_support
Posted: Tuesday, January 27, 2009 8:55:19 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

It doesn't work that way. Checking/unchecking a node and clicking a node are two totally different things. Only the later raises ItemClick event. If you want to do anything when user checks/uncheck a node, you should handle the TreeView's ClientSideOnCheckStateChanging event:

http://doc.essentialobjects.com/ViewDoc.aspx?book=1&t=EO.Web.TreeView.ClientSideOnCheckStateChanging.html

It will be something like this:

Code: HTML/ASPX
<eo:TreeView ClientSideOnCheckStateChanging="check_handler" ...>
....
</eo:TreeView>


Code: JavaScript
function check_handler(treeView, node, oldCheckState, newCheckState)
{
    //Delay the real call until the TreeView has updated its internal
    //state data. If you were to call on_check_changed directly
    //from here, the TreeView would have been still in the old check
    //state
    window.setTimeout(
        function()
        {
            on_check_changed(treeView, node, oldCheckState, newCheckState);
        }, 10);
}

function on_check_changed(treeView, node, oldCheckState, newCheckState)
{
   //do whatever you'd like to do here such as posting
   //back the page or cause an AJAX callback...
   //......
}


Note on_check_changed is a JavaScript function that runs on the client side. So if you wish to perform anything on the server side, you will need to raises a post back or a callback from there. You can call eo_Callback to raises an AJAX callback:

http://doc.essentialobjects.com/ViewDoc.aspx?book=1&t=JSDoc.Public.Global.eo_Callback.html

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.