Template binding for an AutoComplete field in a Pop-Up Editor

2 posts, 0 answers
  1. Brian
    Brian avatar
    6 posts
    Member since:
    Sep 2013

    Posted 17 Oct 2013 Link to this post

    I am trying to put an AutoComplete field into a GridEdit Pop-up dialog.   I am using a custom template to format the listbox.  The problem is that the listbox shows everything as 'undefined'.  If I then click on a listbox item, the correct underlying value is selected and displayed properly.

    If I copy the code, take it out of the PopUp editor, and paste it directly into the parent View, then it works perfectly.

    Something else I tried...
    If I remove the Template altogether than the listbox displays the correct value.  I just lose my custom formatting.

    I've narrowed the problem down to being the Template.  I'm certain that there is something special you have to do with your Template if you are in a Pop-up dialog.  The data is not being binded correctly.

    What should I do to make the Template work right?
        .Placeholder("Select diary code...")
        .DataSource(source =>
            source.Read(read =>
                read.Action("GetSelectList", "DiaryCode");
        .Template("<span style='font-weight: bold;'>${data.Code}</span> <span style='float:right'>${data.Name}</span>")

  2. Daniel
    Daniel avatar
    2177 posts

    Posted 21 Oct 2013 Link to this post


    The most likely reason for the problem is that the expressions are evaluated in the context of the popup template. Please check if using the syntax from this documentation topic instead resolves the problem:

    .Template("<span style='font-weight: bold;'>#:data.Code#</span> <span style='float:right'>#:data.Name#</span>")
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top