Aug 20, 2014, 3:47 PM
[CLOSED] How to update Component column value of one row on edit of component column of another row
Hi,
I have one grid with component column, and I want to update value of one component column of one row on edit of component column of another row.
Below is code for page with javascript function which is called on edit of component column. I set value in store, but unable to reflect it on grid.
Let me know if I am missing something or doing something wrong. Or if there is much easier way to do same.
I have one grid with component column, and I want to update value of one component column of one row on edit of component column of another row.
Below is code for page with javascript function which is called on edit of component column. I set value in store, but unable to reflect it on grid.
Let me know if I am missing something or doing something wrong. Or if there is much easier way to do same.
@model System.Collections.IEnumerable
@{
ViewBag.Title = "ComponentColumn Editor - Ext.NET MVC Examples";
Layout = "~/Views/Shared/_BaseLayout.cshtml";
}
@section headtag
{
<script>
function chngValue(editor, e) {
debugger;
var vv = e.value;
e.grid.store.getAt(3).set('ComboBox', vv);
//e.grid.reload(); //giving me an error
}
</script>
}
@section example
{
<h1>ComponentColumn as Editor</h1>
@(Html.X().GridPanel()
.Title("ComponentColumn Editor")
.Width(600)
.Height(300)
.Store(Html.X().Store()
.Model(Html.X().Model()
.Fields(
new ModelField("IntField", ModelFieldType.Int),
new ModelField("ComboField", ModelFieldType.Int),
new ModelField("TextField", ModelFieldType.String),
new ModelField("DateField", ModelFieldType.Date)
)
)
.DataSource(Model)
)
.ColumnModel(
Html.X().ComponentColumn()
.Editor(true)
.DataIndex("IntField")
.Flex(1)
.Text("Integer")
.Component(Html.X().NumberField()),
Html.X().ComponentColumn()
.Editor(true)
.DataIndex("ComboField")
.Flex(1)
.Text("ComboBox")
.Listeners(ls=>ls.Edit.Fn="chngValue")
.Component(Html.X().ComboBox()
.Items(
new ListItem("Item 1", 1),
new ListItem("Item 2", 2),
new ListItem("Item 3", 3),
new ListItem("Item 4", 4),
new ListItem("Item 5", 5),
new ListItem("Item 6", 6),
new ListItem("Item 7", 7),
new ListItem("Item 8", 8),
new ListItem("Item 9", 9)
)
),
Html.X().ComponentColumn()
.Editor(true)
.DataIndex("TextField")
.Flex(1)
.Text("Text")
.Component(Html.X().TextField()),
Html.X().ComponentColumn()
.Editor(true)
.DataIndex("DateField")
.Flex(1)
.Text("Date")
.Component(Html.X().DateField())
)
)
}
Last edited by Daniil; Aug 21, 2014 at 9:01 AM.
Reason: [CLOSED]