This is a migrated thread and some comments may be shown as answers.

How to change item definitions

4 Answers 130 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Regis Bittencourt
Top achievements
Rank 1
Regis Bittencourt asked on 18 Jan 2013, 05:21 PM
Hi,

If you compare the way you override the item definitions here:
  • http://docs.kendoui.com/getting-started/web/treeview/overview#item-definition

"The 
textimageUrlspriteCssClass and url fields can be changed through the datatextfielddataimageurlfield,dataspritecssclassfield, and dataurlfield, respectively."

And the way you override it here:
  • http://docs.kendoui.com/getting-started/framework/hierarchicaldatasource/overview#the-haschildren-property

The hasChildren property

The hasChildren boolean property indicates whether a data item contains children that can be fetched from the server. You can either hard-code it, map it to another property, or compute it with a function:



You can see that there is no standand. 
I need something like that to my project's datasouce options:
    schema: {
           model: {
               id: "Id",
               hasChildren: "HasChildUnits",
               expanded: "ChildrenDownloaded"
           }
       }
But that does not work as expected. The hasChildren made me believe that this would work.

I think it is a bug.

4 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 21 Jan 2013, 09:59 AM
Hello Regis,

Data projection is not currently supported. In case you need to map the fields, you supply a schema.parse function that makes a one-way projection of the data, as shown in this jsBin sample.

Kind regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Regis Bittencourt
Top achievements
Rank 1
answered on 22 Jan 2013, 02:42 PM
That is definetely what I need and it works!
That should be on the Get started or better documented or exemplified in here
http://docs.kendoui.com/api/framework/datasource#schemaparse-function.

Thank you very much.
0
Tim
Top achievements
Rank 1
answered on 21 May 2015, 10:41 PM

It seems the parse function gets in front of AngularJS's HTTP intercept functions. This is problematic as any service logic there will have to be repeated in my parse function. I use it to pass back out of band status data and other structured information in addition to the requested json text.

Can you all consider moving parse behind $httpProvider interceptors? That would greatly simplify the usage of this routine for Angular implementations and fit the expected behavior.

Otherwise this is clean and effective!

Thanks

0
Alex Gyoshev
Telerik team
answered on 25 May 2015, 11:55 AM

Hello Tim,

If you are using the default transport, perhaps you can resolve this via a custom transport function that calls $http?

transport: {
  read: function(options) {
    $http(options);
  }
}

If that doesn't help, can you please show an example of the problematic functionality?

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Regis Bittencourt
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Regis Bittencourt
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Share this question
or