User defined object field with custom pop up editor is not filled with data

8 posts, 0 answers
  1. Sameh Awad
    Sameh Awad avatar
    1 posts
    Member since:
    Sep 2009

    Posted 18 Jan 2013 Link to this post

    Hi,

    I have a grid with editing set to popup. The model bound to the grid has a user defined field object (consisting of an ID and description) with its own custom editor (created in the shared folder) as 2 dropdownlists cascaded. (example the grid has a field called car which is composed of manufactureID and manufactureDescription and modelID and modelDescription)

    I have two issues:
    1- I am not able to get the data selected from any of the dropdownlists to be passed correctly to the user defined field of the grid. It always returns null.
    2- How can i use cascaded dropdownlists for "dropdownlistsfor" knowing that the name property for this dropdownlist is becoming complicated as shown by firebug for example car_manufactureID-listbox. Changing the cascade property to this name doesn't link to the dropdownlist but when specifing another name the cascade feature is working.

    I believe that my issue might be in the name of the dropdownlist but it is not working even when i remove the dropdownlist name completely


    Best regards,
    Sameh
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 22 Jan 2013 Link to this post

    Hi Sameh,

     
    We just uploaded new CodeLibrary - Grid InLine and PopUp Editing using Cascading DropDownLists. I would suggest to check this demo project and let us know if you face any difficulties implementing this solution in your project. 

    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Sameh Awad
    Sameh Awad avatar
    1 posts
    Member since:
    Sep 2009

    Posted 24 Jan 2013 Link to this post

    Hello,

    Thanks for the sample sent, but it didn't cover my question. From my research on the internet I found that the grid doesn't accept complex model with user defined objects in it instead I should use a flat structure for the grid. Is this correct?

    Sameh
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 28 Jan 2013 Link to this post

    Hi Sameh,

     
    You are correct - currently using complex models with the Kendo Grid is not supported and you should use flat structure.

    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. kd345205
    kd345205 avatar
    3 posts
    Member since:
    Mar 2009

    Posted 25 Feb 2013 Link to this post

    I think I am trying to do the same thing. I finally got the InCell editing with a custom property object after following the example. However, once I changed it back to PopUp editing it was broken again instantly. I searched around and found this post and then changed the example project to use PopUp editing to check things, and it does not work there either.

    Is this the same thing you are saying here? When will this be fixed?

    I'm somewhat relieved, but wish I had a few days of my time back after fighting with this forever. Wish this was noted a little more clearly in the documentation or example pages.
  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 26 Feb 2013 Link to this post

    Hi Kiel,

     
    From the provided information it's not clear what is the exact issue that you are experiencing - I would suggest to open a new support ticket with more details about your current grid setup and what exactly you are trying to achieve. That way we will be able to help you straight away.

    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. kd345205
    kd345205 avatar
    3 posts
    Member since:
    Mar 2009

    Posted 26 Feb 2013 Link to this post

    The exact issue is that the popup editor does not seem to work in specific scenarios. Take Telerik's demo MVC application and go to the Grid's  "Editing Custom Editor" and make the grid use popup editing.

    You will need to remove the save button and a few other things, but the result is that the "Employee" editor template is not used and the ID field being visible and not editable is also not working.

    My scenario is identical to that example in that I am trying to use a custom editor to edit a complex property of the object the grid is displaying. When using "InCell" editing it works fine, but PopUp editing is not using the same properties.

    After making changes you should end up with code close to this on the front end:
    @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ClientOrderViewModel>()
        .Name("Grid")
            .Columns(columns =>
            {
                columns.Command(col => col.Edit()); 
            columns.Bound(p => p.OrderID);
            columns.Bound(p => p.Employee).ClientTemplate("#=Employee.EmployeeName#");
            columns.Bound(p => p.ShipAddress);       
        })   
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Pageable()
        .Sortable()
        .Scrollable()
        .DataSource(dataSource => dataSource       
            .Ajax()     
            .ServerOperation(true)
            .Events(events => events.Error("error_handler"))
            .Model(model => {
                model.Id(p => p.OrderID);
                model.Field(p => p.OrderID).Editable(false);
            })     
            .Read(read => read.Action("EditingCustom_Read", "Grid"))
            .Update(update => update.Action("EditingCustom_Update", "Grid"))      
        )
    )
  8. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 28 Feb 2013 Link to this post

    Hi Kiel,

    In PopUp editing the Grid uses the EditorForModel helper to generate the template which by default does not render the editors for complex types. You could either use custom popup template as demonstrated in this code library or override the MVC default object template.

    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top