We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Event binding

Thread ID:

Created:

Updated:

Platform:

Replies:

117673 Nov 26,2014 10:47 AM UTC Nov 28,2014 04:08 AM UTC JavaScript 2
loading
Tags: ejTreeView
Andrzej Siedy
Asked On November 26, 2014 10:47 AM UTC

Hi,

I'm new to Syncfusion libs, and got very confused with docu and components design.

Any way...
trying to bind to ejTreeView events for e.g.
 as per documentation I tried to do like:

function checkCallback() {
                    console.log('check', arguments);
                }

var myTree = $('#treeDiv').ejTreeView({
                    fields: { id: "id", parentId: "pid", text: "name", hasChild: "hasChild", dataSource: outlookicons, expanded: "expanded" },
                    allowEditing: true,
                    allowDragAndDrop: true,
                    check: 'checkCallback' // <- NEVER fired - strange way of binding callbacks
                });

Does Syncfusion components support standard way of binding to the events?

myTree.on('check', function(){}); 
myTree.un('check', function(){}); 
myTree.on('dropped', function(){}); 
myTree.on('beforedrop', function(){}); 
etc.
Any help appreciated.

Andrzej



Andrzej Siedy
Replied On November 26, 2014 02:48 PM UTC

Ok, got that
$('#treeDiv').ejTreeView('model.nodeCheck', function(){ });

Harikrishnan P [Syncfusion]
Replied On November 28, 2014 04:08 AM UTC

Hi Andrzej,

Thanks for using Syncfusion products.

Query: check: 'checkCallback' // <- NEVER fired - strange way of binding callbacks

We would like to let you know that, there is no event in Treeview component as “check”. In the above code instead of specifying the event name as “nodeCheck” it is used as “check”. Please change it to “nodeCheck” and the event will fire properly.

We can also bind the events attach its callback function, on the event declaration itself. Please refer the below code

 

[Script]

 

//callback function attached on the event declaration itself

                var myTree = $('#treeDiv').ejTreeView({

                    fields: { id: "id", parentId: "pid", text: "name", hasChild: "hasChild", dataSource: outlookicons, expanded: "expanded" },

                    allowEditing: true,

                    allowDragAndDrop: true,

                    nodeCheck: function (args) {

                        alert("Check event trigerred");

                    }

                });

 

 

Query: Does Syncfusion components support standard way of binding to the events?

Yes, Syncfusion components support standard structure for binding the events as like binding the jQuery events. Please refer the below code,

          

[Script]

 

//standard structure for binding events as like binding jQuery events

//while using this structure, the event name has to be specified in the format "pluginname" + "corresponding event name"

//Here in "ejTreeViewnodeCheck" ejTreeView is the plugin name and nodeCheck is the event name

            $("#treeView").on('ejTreeViewnodeCheck', function () {

                alert("Checkbox Checked");

            });

 

 

For your convenience, we have attached a sample in the following location to exhibit the above behavior. Please download the sample from the following location

Sample Location : Treeview Sample

Please let us know if you have further queries

Regards,

HariKrishnan


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;