Oct 11, 2013, 3:19 PM
[CLOSED] ComponentColumn with PartialViewResult, Replace Mode
Hi,
I have a GridPanel with ComponentColumn, and I need to replace this GridPanel each times I click the button.
But the problem is: the ComponentColumn disappears in the first click and all GridPanel disappears in the second click.
The test code:
Thank you in advance.
I have a GridPanel with ComponentColumn, and I need to replace this GridPanel each times I click the button.
But the problem is: the ComponentColumn disappears in the first click and all GridPanel disappears in the second click.
The test code:
public class TestController : Controller
{
public ActionResult Index()
{
var model = new TimeSpan(14, 14, 14);
return View(model);
}
public ActionResult ReLoad()
{
return new PartialViewResult
{
ContainerId = "MyPanel",
RenderMode = RenderMode.Replace
};
}
}
Index.cshtml@model dynamic
@{
Layout = null;
var datasource = new object[]
{
new { Column1 = "Text 1", Column2 = true },
new { Column1 = "Text 2", Column2 = false },
new { Column1 = "Text 3", Column2 = true },
new { Column1 = "Text 4", Column2 = false },
new { Column1 = "Text 5", Column2 = true },
new { Column1 = "Text 6", Column2 = false },
new { Column1 = "Text 7", Column2 = true },
new { Column1 = "Text 8", Column2 = false },
new { Column1 = "Text 9", Column2 = true }
};
}
@(Html.X().ResourceManager())
@(Html.X().Button().Text("ReLoad")
.DirectEvents(d =>
{
d.Click.Url = Url.Action("ReLoad");
}))
@(Html.X().Panel().Width(400).ID("MyPanel").Layout(LayoutType.Fit)
.Items(Html.X().GridPanel().Border(false)
.Store(Html.X().Store()
.Model(Html.X().Model()
.Fields(Html.X().ModelField().Name("Column1").SortType(SortTypeMethod.AsText),
Html.X().ModelField().Name("Column2").Type(ModelFieldType.Boolean)))
.DataSource(datasource)
)
.ColumnModel(c =>
{
c.Add(Html.X().Column().DataIndex("Column1")
.Text("Column1").Flex(1).Sortable(true));
c.Add(Html.X().ComponentColumn().DataIndex("Column2").Editor(true).Sortable(false)
.Align(Alignment.Center).Component(Html.X().Checkbox()));
}
)))
Reload.cshtml:@model dynamic
@{
Layout = null;
var datasource = new object[]
{
new { Column1 = "Text 1", Column2 = true },
new { Column1 = "Text 2", Column2 = false },
new { Column1 = "Text 3", Column2 = true },
new { Column1 = "Text 4", Column2 = false },
new { Column1 = "Text 5", Column2 = true },
new { Column1 = "Text 6", Column2 = false },
new { Column1 = "Text 7", Column2 = true },
new { Column1 = "Text 8", Column2 = false },
new { Column1 = "Text 9", Column2 = true }
};
}
@(Html.X().Panel().Width(400).ID("MyPanel").Layout(LayoutType.Fit)
.Items(Html.X().GridPanel().Border(false)
.Store(Html.X().Store()
.Model(Html.X().Model()
.Fields(Html.X().ModelField().Name("Column1").SortType(SortTypeMethod.AsText),
Html.X().ModelField().Name("Column2").Type(ModelFieldType.Boolean)))
.DataSource(datasource)
)
.ColumnModel(c =>
{
c.Add(Html.X().Column().DataIndex("Column1")
.Text("Column1").Flex(1).Sortable(true));
c.Add(Html.X().ComponentColumn().DataIndex("Column2").Editor(true).Sortable(false)
.Align(Alignment.Center).Component(Html.X().Checkbox()));
}
)))
Do you have any idea to resolve this problem?Thank you in advance.
Last edited by Daniil; Oct 24, 2013 at 12:58 PM.
Reason: [CLOSED]