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

Giving parameters to the datasource (binding)

6 Answers 41 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Yngve
Top achievements
Rank 1
Yngve asked on 12 Apr 2017, 07:59 AM

Hi,

 

I've been searching on the net for some while to see if there's a way to do this. I'll try my best to formulate what I mean in an understandable way.

 

Example

Take this view for instance. I was wondering if there's any way to specifiy a parameter to the Action.

 

What I essentially am trying to do is this; I have a organizational diagram of some business. And say this map only contains the names of the employees and departments. But the view contains different checkboxes for altering the map. If I for instance press a certain checkbox, I would like to see the organizational map with both names AND titles of the employees. So in that case I want to send an int value of for example 1 to the Action to indicate what values the diagram should contain. Is there a way to declare this in the view? 

 

6 Answers, 1 is accepted

Sort by
0
Stamo Gochev
Telerik team
answered on 13 Apr 2017, 01:25 PM
Hi Yngve,

You can provide additional parameters to the DataSource methods as described in this forum thread:

http://www.telerik.com/forums/pass-additional-parameters-to-read-ajax-datasource-method---mvc


Regards,
Stamo Gochev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Yngve
Top achievements
Rank 1
answered on 18 Apr 2017, 12:17 PM
Hi, thanks for the answer. How would I go about invoking the read function in a javascript function though?
0
Tsvetina
Telerik team
answered on 20 Apr 2017, 09:50 AM
Hi Yngwe,

You can access the Diagram client instance and call its DataSource read() method like this:
$("#diagram").data("kendoDiagram").dataSource.read();


Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Yngve
Top achievements
Rank 1
answered on 21 Apr 2017, 06:24 AM
That didn't seem to work. I got this error: Uncaught TypeError: Cannot read property 'dataSource' of undefined.

VM511:1 Uncaught TypeError: Cannot read property 'dataSource' of undefined at <anonymous>:1:35
VM511:1 Uncaught TypeError: Cannot read property 'dataSource' of undefined at <anonymous>:1:35
0
Tsvetina
Telerik team
answered on 21 Apr 2017, 11:39 AM
Hello Yngwe,

Can you confirm that you are calling this line at a point of time when the Diagram is created (already visible) and that your Diagram Name is indeed "diagram"? The id used to find the Diagram jQuery element corresponds to the Name value you set for the Diagram.
Can you show the code that you are trying to run, maybe update the Pastebin?

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Yngve
Top achievements
Rank 1
answered on 21 Apr 2017, 01:57 PM

Yes, I'm calling it after the Diagram is created and already visible. My diagram name is definitely "diagram". 

It did however work when I used this code, which I didn't find on your website but after some google searching.

$("#diagram").getKendoDiagram().dataSource.read();
$("#diagram").getKendoDiagram().refresh();
Tags
Diagram
Asked by
Yngve
Top achievements
Rank 1
Answers by
Stamo Gochev
Telerik team
Yngve
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or