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

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

7 Answers 346 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sameh Awad
Top achievements
Rank 1
Sameh Awad asked on 18 Jan 2013, 10:44 PM
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

7 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 22 Jan 2013, 01:47 PM
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!
0
Sameh Awad
Top achievements
Rank 1
answered on 24 Jan 2013, 07:01 PM
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
0
Vladimir Iliev
Telerik team
answered on 28 Jan 2013, 03:35 PM
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!
0
kd345205
Top achievements
Rank 1
answered on 25 Feb 2013, 09:49 PM
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.
0
Vladimir Iliev
Telerik team
answered on 26 Feb 2013, 08:36 AM
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!
0
kd345205
Top achievements
Rank 1
answered on 26 Feb 2013, 01:36 PM
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"))      
    )
)
0
Vladimir Iliev
Telerik team
answered on 28 Feb 2013, 01:05 PM
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!
Tags
Grid
Asked by
Sameh Awad
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Sameh Awad
Top achievements
Rank 1
kd345205
Top achievements
Rank 1
Share this question
or