May 19, 2015, 6:49 PM
[CLOSED] GridPanel : Grid with AutoSave Date not insert in grid
I do bellow code but the date not show in grid after click add
<script>
var addRecordtoGridPFNomination = function (form, grid) {
if (!form.getForm().isValid()) {
return false;
}
console.log(form.getForm().getValues());
grid.store.insert(0, new Model_PFNomination(form.getForm().getValues()));
form.getForm().reset();
};
</script>
@( X.FormPanel()
.Border(true)
.Title("Nominee")
.BodyStyle("background-color: #F1F1F1;")
.Items(
X.FieldSet()
.Border(false)
.ColumnWidth(0.4)
.Items(
X.FieldContainer().Layout(LayoutType.HBox)
.Items
(
X.DateField()
.ID("NomineeDateofBirth")
.Name("NomineeDateofBirth")
.FieldLabel("Date of Birth")
.AnchorHorizontal("100%")
.Format("dd-MM-yyyy")
.LabelAlign(LabelAlign.Right)
)
,
X.GridPanel()
.ID("GridPFNomination")
.Scroll(ScrollMode.Both)
.ColumnWidth(1.0)
.AutoScroll(true)
.Height(150)
.SetAutoScroll(true)
.Store
(
X.Store()
.ID("Store_PFNomination")
.Model
(
X.Model()
.Name("Model_PFNomination")
.IDProperty("EmployeeNomineeID")
.Fields
(
X.ModelField()
.Name("NomineeDateofBirth")
.ServerMapping("NomineeDateofBirth")
.Type(ModelFieldType.Date)
.DateFormat("dd-MM-yyyy")
)
)
)
.ColumnModel
(
X.DateColumn()
.DataIndex("NomineeDateofBirth")
.Text("Date of Birth")
.Sortable(false)
.MenuDisabled(true)
.Resizable(false)
.Width(100)
.Format("dd-MM-yyyy")
)
.Listeners(l => l.SelectionChange.Handler = @"if (selected[0])
{
this.up('form').getForm().loadRecord(selected[0]);
}"
)
)
)
.Buttons(
Html.X().Button()
.Text("Add")
.Icon(Icon.UserAdd)
.Handler(@"addRecordtoGridPFNomination(this.up('form'), App.GridPFNomination)"),
Html.X().Button()
.Text("Reset")
.Handler("this.up('form').getForm().reset();")
)
)
Last edited by Daniil; May 26, 2015 at 4:19 PM.
Reason: [CLOSED]