Customize field label in edit dialog

3 posts, 1 answers
  1. Zoltan
    Zoltan avatar
    4 posts
    Member since:
    Feb 2012

    Posted 07 Jun Link to this post

    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. Answer
    Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 09 Jun Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Zoltan
    Zoltan avatar
    4 posts
    Member since:
    Feb 2012

    Posted 10 Jun in reply to Daniel Link to this post

    Thank you, that's working.
Back to Top