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. Image for the cookie policy date
close icon

htmlAttribute raises error in _setAttributes


I'm trying to create a treeview as result of a json request, but the treeview fails to set the HtmlAttributes.

Assuming that:

data= [{Id:"G_3",PId:"",Name:"test",HasChild:true,IsExpanded:false,IsGroup:true,Order:0,ImageUrl:"/content/img/folder.png",ElementId:3,HtmlAttributes:null},{Id:"L_2",PId:"G_3",Name:"test1",HasChild:false,IsExpanded:false,IsGroup:false,Order:0,ImageUrl:"",ElementId:2,HtmlAttributes:{"data-elementid":"2"}},{Id:"L_3",PId:"G_3",Name:"test3",HasChild:false,IsExpanded:false,IsGroup:false,Order:0,ImageUrl:"",ElementId:3,HtmlAttributes:{"data-elementid":"3"}}]
       

$.post(mViewPage.baseUrl + '/treeview/mapview/' + cod).done(function (data) {
            $("#mtreeview").ejTreeView({
                showCheckbox: true,
                fields: {
                    id: "Id", parentId: "PId", text: "Name", hasChild: "HasChild", dataSource: data, imageUrl: "imageUrl",htmlAttribute: "HtmlAttributes"
                }
            });
});

I've traced the problem to the following code in ej.treeview.js, when the _setAttributes is called, the element.attr is undefined

_setAttributes: function(data, element) {
            for (var key in data) {
                element.attr(key, data[key]); //element.attr is undefined
            }
        },


  
Is this some sort of bug or am I missing something?

Thanks





6 Replies

RL RL February 6, 2015 12:18 AM UTC

I've changed the code in ej.treeview.js to be:
_setAttributes: function (data, element) {
            for (var key in data) {
                $(element).attr(key, data[key]);
            }
        },

and now it works. I still fill something is off here.


SS Saranya Sivakumar Syncfusion Team February 6, 2015 11:28 AM UTC

Hi Rui,

Thanks for using Syncfusion products.

We would like to let you know that, “Treeview fails to set the HtmlAttributes” is a known issue and it has been fixed in our latest service pack release (12.4.0.30). We would like you to upgrade to latest version and it can be downloaded from the following link:

http://www.syncfusion.com/forums/118097/essential-studio-2014-volume-4-service-pack-release-v12-4-0-30-available-for-download

For your convenience we have prepared the sample, please download the sample from the following location.

Sample Location: Sample

Please let us know if you have further concern.

Regards,

Saranya.S




RL RL February 6, 2015 12:51 PM UTC

Thanks, I see that only the .min.js are included, is it possible to get the non minified version of the js files?
I'm having a lot of issues with the controls and would be very helpful if I could see the not minified sources.


SS Saranya Sivakumar Syncfusion Team February 9, 2015 01:01 PM UTC

Hi Rui,

As per our support guidelines; through forums widely we offer only limited and basic assistance. 

Since you have requested for non-minified version of the JS files, it is beyond our support limit consigned for a forum.

A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Regards,

Saranya.S




RL RL February 9, 2015 07:43 PM UTC

I understand. Thank you. I've closed the ticket, the initial problem has been fixed.


SS Saranya Sivakumar Syncfusion Team February 10, 2015 06:37 AM UTC

Hi Rui,
Thanks for your update.
Please let us know if you have further concern.
Regards,
Saranya.S



Loader.
Live Chat Icon For mobile
Up arrow icon