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

Customize field label in edit dialog

2 Answers 175 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Zoltan
Top achievements
Rank 1
Zoltan asked on 07 Jun 2016, 12:44 PM

Hello,

I have one field in Connection model that user should be able to change - "MyConnectionField" in example below.

The thing is that this field can contain different types of data depending on other field in the model. When user clicks on connection in diagram and chooses Edit, dialog pops up with the editable field with label "MyConnectionField". How can I change this label depending on other field in the Connection model - "MyTypeField" in example below?

@(Html.Kendo().Diagram<Shape, Connection>()
 ...
 .ConnectionsDataSource(d => d
    .Model(m =>
    {
        m.Id(c => c.Id); m.Field(c => c.MyTypeField);
           m.Field(c => c.MyConnectionField).Editable(true);
    })
    .Read(r =>
    {
        r.Action("MyAction", "MyController");
    })
 )
 .ConnectionDefaults(cd => cd
    .Editable(e => e.Drag(false).Remove(false)
         .Tools(t => {
              t.Edit();
         })
     )
 )
 ...
)

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 09 Jun 2016, 08:35 AM
Hello Zoltan,

Given that you need to dynamically set the label I would suggest to use the edit event e.g.
function onEdit(e) {
    if (e.connection) {
        var label = getLabel(e.connection);
        e.container.find("label[for='MyConnectionField']").text(label);
    }
}


Regards,
Daniel
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Zoltan
Top achievements
Rank 1
answered on 10 Jun 2016, 02:49 PM
Thank you, that's working.
Tags
Diagram
Asked by
Zoltan
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Zoltan
Top achievements
Rank 1
Share this question
or