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

[Solved] Problem with Edit Mode InCell, with Grid inside a two levels TabStrip structure

1 Answer 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Giordano
Top achievements
Rank 1
Giordano asked on 14 Nov 2011, 06:21 PM
Hi all,
i have a problem using mvc Grid.

My structure is composed of a list of division, which contains a list of objects of type Table, which contains a list of objects of type Row
Each Row contains the following properties: TranslationUK, TranslationUS, TranslationFR, etc. ....
I should create a tab for each division. Each Division will have a tab for each Table, and each Table will have a grid that will contain objects of type Row. The grid must be editable in Incell mode.

This is my View:
(Model is IEnumerable<Division>)

@using (Html.BeginForm("Execute", "Divisions", FormMethod.Post, new { id = "modifyForm" }))
{
    Html.Telerik().TabStrip()
        .Name("TabStripDivision")
        .Items(tabstripDivision =>
        {
            foreach (var division in Model)
            {
                var currentDivision = ObjectCopier.Clone(division);
                tabstripDivision.Add().Text(currentDivision.ID.ToString())
                    .Content(o =>
                        Html.Telerik().TabStrip().HtmlAttributes(new { id = currentDivision.ID.ToString() })
                            .Name("tabstrip" + currentDivision.ID)
                            .Items(tabstripTable =>
                             {
                                foreach (var table in currentDivision.Tables)
                                {
                                    var currentTable = ObjectCopier.Clone(table);
                                    tabstripTable.Add().HtmlAttributes(new { id = currentTable.Name.ToString() + currentDivision.ID.ToString() })
                                        .Text(currentTable.Name.ToString() + currentDivision.ID.ToString())
                                        .Content(i =>
                                                Html.Telerik().Grid(currentTable.Rows).Name(currentTable.Name.ToString()).DataKeys(datakey => datakey.Add(row => row.ID))
                                                    .DataBinding(dataBinding => dataBinding.Ajax().Update("_SaveBatchEditing", "Divisions"))
                                                    .Columns((columns) =>
                                                        {
                                                            columns.Bound(d => d.ID);
                                                            columns.Bound(d => d.Description);
                                                            columns.Bound(d => d.TranslationUK).Visible(CheckColumnVisibility(currentDivision, "UK"));
                                                            columns.Bound(d => d.TranslationUS).Visible(CheckColumnVisibility(currentDivision, "US"));
                                                            columns.Bound(d => d.TranslationFR).Visible(CheckColumnVisibility(currentDivision, "FR"));
                                                            columns.Bound(d => d.TranslationIT).Visible(CheckColumnVisibility(currentDivision, "IT"));
                                                            columns.Bound(d => d.TranslationDE).Visible(CheckColumnVisibility(currentDivision, "DE"));
                                                            columns.Bound(d => d.TranslationES).Visible(CheckColumnVisibility(currentDivision, "ES"));
                                                            columns.Bound(d => d.TranslationJP).Visible(CheckColumnVisibility(currentDivision, "JP"));
                                                            columns.Bound(d => d.TranslationCN).Visible(CheckColumnVisibility(currentDivision, "CN"));
                                                            columns.Bound(d => d.TranslationKR).Visible(CheckColumnVisibility(currentDivision, "KR"));
                                                            columns.Bound(d => d.TranslationGR).Visible(CheckColumnVisibility(currentDivision, "GR"));
                                                            columns.Bound(d => d.TranslationRU).Visible(CheckColumnVisibility(currentDivision, "RU"));
 
                                                        }).DataBinding(dataBindings => dataBindings.Ajax().Select("_Filtering", "Divisions"))
                                                    .Pageable() .Sortable() .Filterable().Editable(editing => editing.Mode(GridEditMode.InCell)).
                                                    ToolBar(commands =>
                                                          {
                                                               commands.SubmitChanges();
                                                          })
                                        );
                                }
                            })
                        .SelectedIndex(selectedTabStripTable));
            }
        }).SelectedIndex(selectedTabStrip).Render();
}

The attachment "capture.jpg" show my structure.

In _Layout.cshtml i register manually javascript file:
(I use JQuery 1.6.4)
@(Html.Telerik().ScriptRegistrar().jQuery(false) 
            .DefaultGroup(group =>
                group.Add("telerik.common.js")
                     .Add("telerik.grid.js") 
                     .Add("telerik.textbox.js")
                     .Add("telerik.grid.filtering.js")
                     .Add("telerik.draganddrop.js")
                     .Add("telerik.grid.grouping.js"))

The tabs and grids are displayed correctly.
The problem is in editing.

Following the screenshot if I'm in tab "22" I can edit the values inside the tabs "Cat_Materiali22" and "Cat_Misure22".
If I'm on tab "23" or "24" the cells inside tabs "Cat_Materiali24" and "Cat_Misure24" (or "Cat_Materiali23" and "Cat_Misure23") can't be edited.
My editing Mode should be GridEditMode.InCell.

I do not know how to solve the problem...
Maybe some  javascript problems??

Has anyone come across this issue?

Thanks!!

1 Answer, 1 is accepted

Sort by
0
Giordano
Top achievements
Rank 1
answered on 16 Nov 2011, 11:08 AM
ok, i have solve the problem

Each grid need to be unique name, and sometimes in my scenario
currentTable.Name.ToString() is not.

Tags
Grid
Asked by
Giordano
Top achievements
Rank 1
Answers by
Giordano
Top achievements
Rank 1
Share this question
or