sveins12
Oct 06, 2016, 10:09 PM
When editing a record, the SelectField always shows the value "Object 1" as the initial value. I think it should show a different value for each of the record in the example, "Object 1", "Object 2" and "Object 3":
Controller-code:
public class TestController : Controller
{
public ActionResult GetMainSet()
{
return Json(new List<object>
{
new { text="Main 1", selected=1 },
new { text="Main 2", selected=2 },
new { text="Main 3", selected=3 }
}, JsonRequestBehavior.AllowGet);
}
public ActionResult GetSelectables()
{
return Json(new List<object>
{
new { text="Object 1", value=1 },
new { text="Object 2", value=2 },
new { text="Object 3", value=3 }
}, JsonRequestBehavior.AllowGet);
}
}
View-code:
@{
var x = Html.X();
}
@(
x.Grid()
.FullScreen(true)
.Title("SelectField test")
.Store(x.Store()
.Fields(
x.ModelField().Name("text"),
x.ModelField().Name("selected")
)
.Proxy(x.AjaxProxy()
.Url("/Test/GetMainSet")
)
)
.Plugins(x.EditableGrid())
.Columns(
x.Column()
.DataIndex("text")
.Text("text")
,
x.Column()
.Text("selected")
.DataIndex("selected")
.Editable(true)
.Editor(x.SelectField()
.Store(x.Store()
.Proxy(x.AjaxProxy()
.Url("/Test/GetSelectables")
)
)
)
)
)
Controller-code:
public class TestController : Controller
{
public ActionResult GetMainSet()
{
return Json(new List<object>
{
new { text="Main 1", selected=1 },
new { text="Main 2", selected=2 },
new { text="Main 3", selected=3 }
}, JsonRequestBehavior.AllowGet);
}
public ActionResult GetSelectables()
{
return Json(new List<object>
{
new { text="Object 1", value=1 },
new { text="Object 2", value=2 },
new { text="Object 3", value=3 }
}, JsonRequestBehavior.AllowGet);
}
}
View-code:
@{
var x = Html.X();
}
@(
x.Grid()
.FullScreen(true)
.Title("SelectField test")
.Store(x.Store()
.Fields(
x.ModelField().Name("text"),
x.ModelField().Name("selected")
)
.Proxy(x.AjaxProxy()
.Url("/Test/GetMainSet")
)
)
.Plugins(x.EditableGrid())
.Columns(
x.Column()
.DataIndex("text")
.Text("text")
,
x.Column()
.Text("selected")
.DataIndex("selected")
.Editable(true)
.Editor(x.SelectField()
.Store(x.Store()
.Proxy(x.AjaxProxy()
.Url("/Test/GetSelectables")
)
)
)
)
)