Jan 08, 2015, 4:07 AM
How gridpanel goes to editable mode on rowcommand click
I have gridpanel, my target is that when i click on rowcommand the gridpanel change mode and go to editable mode and show two button of save and cancel, and when i press save data save to model and gridpanel goes to normal mode and when i press cancel no change happen and goes to normal mode, is there any way to handle this???
@(Html.X().ResourceManager())
@(Html.X().GridPanel()
.Title("ComponentColumn Pin Editor")
.Width(1000)
.Height(300)
.Store(Html.X().Store()
.Model(Html.X().Model()
.Fields(
new ModelField("Id", ModelFieldType.Int),
new ModelField("FName", ModelFieldType.String),
new ModelField("LName", ModelFieldType.String),
new ModelField("Position", ModelFieldType.String),
new ModelField("Salary", ModelFieldType.Float),
new ModelField("Register", ModelFieldType.Date)
)
)
.DataSource(Model)
)
.ColumnModel(
Html.X().ComponentColumn()
.Editor(true)
.OverOnly(true)
.Pin(true)
.DataIndex("Id")
.Flex(1)
.Text("Player Number")
.Component(Html.X().NumberField()),
Html.X().ComponentColumn()
.Editor(true)
.OverOnly(true)
.Pin(true)
.DataIndex("FName")
.Flex(1)
.Text("First Name")
.Component(Html.X().TextField()),
Html.X().ComponentColumn()
.Editor(true)
.OverOnly(true)
.Pin(true)
.DataIndex("LName")
.Flex(1)
.Text("LastName")
.Component(Html.X().TextField()),
Html.X().ComponentColumn()
.Editor(true)
.OverOnly(true)
.Pin(true)
.DataIndex("Position")
.Flex(1)
.Text("Position")
.Component(Html.X().TextField()),
Html.X().ComponentColumn()
.Editor(true)
.OverOnly(true)
.Pin(true)
.DataIndex("Salary")
.Flex(1)
.Text("Salary")
.Renderer(RendererFormat.UsMoney)
.Component(Html.X().NumberField()),
Html.X().ComponentColumn()
.Editor(true)
.OverOnly(true)
.Pin(true)
.DataIndex("Register")
.Flex(1)
.Text("Register")
.Renderer(new Renderer()
{
Format = RendererFormat.Date,
FormatArgs = new string[] { "'d/m/Y'" }
})
.Component(Html.X().DateField().Format("dd/MM/yyyy")),
Html.X().CommandColumn()
.Width(100)
.Commands(
Html.X().GridCommand()
.CommandName("Edit")
.Text("Edit")
.Icon(Icon.ApplicationEdit)
.ToolTip(tt => tt.Text = "Edit"),
Html.X().GridCommand()
.CommandName("Delete")
.Text("Delete")
.Icon(Icon.Delete)
.ToolTip(tt => tt.Text = "Delete"),
Html.X().GridCommand()
.CommandName("Save")
.Text("Save")
.Icon(Icon.ApplicationEdit)
.ToolTip(tt => tt.Text = "Save"),
Html.X().GridCommand()
.CommandName("Cancel")
.Text("Cancel")
.Icon(Icon.ApplicationEdit)
.ToolTip(tt => tt.Text = "Cancel")
)
)
)
Last edited by parhamparsa; Jan 08, 2015 at 4:36 AM.