or
Hi
I have grid with template for column A
template:
'<input type="checkbox" class="Acolumn" #= A ? checked="checked" : "" # />'
$(divGrid).delegate(
".AColumn"
,
"click"
,
function
(e) {
var
dataItem = grid.dataItem($(
this
).closest(
"tr"
));
dataItem.A = $(
this
).is(
':checked'
);
});
Data Source configured with following options: autosync, transport update url, batch
Grid configuration : editable. Save changes button at the grid header.
It works ok when checkbox is selected data in data source changed successfully but Save changes button of the grid doesn't call update method of data source.
What could be a reason of this issue?
I have used Kendo grid, I need to select a row without command columns.
Here is my code..<script type="text/javascript"> $(document).ready(function () { var transport = { read: { contentType: "application/json; charset=utf-8", type: "POST", dataType: "json", url: "JQueryGrid/Grid_Read" }, update: { url: "JQueryGrid/Grid_Update", contentType: "application/json; charset=utf-8", type: "POST" }, create: { url: "JQueryGrid/Grid_Create", type: "POST" }, destroy: { contentType: "application/json; charset=utf-8", url: "JQueryGrid/Grid_Destroy", type: "POST", dataType: "json" }, parameterMap: function (data, operation) { return kendo.stringify(data); } }; var dataSource = new kendo.data.DataSource({ transport: transport, batch: true, pageSize: 30, schema: { model: { id: "PersonalID", fields: { PersonalID: { type: "number", editable: false }, FirstName: { type: "string", validation: { required: true} }, LastName: { type: "string", validation: { required: true} }, DOB: { type: "date" } } } } }); $("#grid").kendoGrid({ dataSource: dataSource, height: 250, filterable: true, type: "odata", sortable: true, pageable: true, editable: "inline", toolbar: ["create"], columns: [ { field: "PersonalID", filterable: false, width: 100 }, { field: "FirstName", title: "First Name", width: 200 }, { field: "LastName", title: "Last Name", width: 200 }, { field: "DOB", title: "Date born", width: 100, format: "{0:MM/dd/yyyy}" }, { command: ["edit", "destroy"], title: " ", width: "210px" } ] }); }); </script>
public ActionResult Grid_Read() { var personalDtos = _personalService.GetAllPersonalByFilters(1, string.Empty); return Json(personalDtos); } [HttpPost] public ActionResult Grid_Update(PersonalDto dto) //<--- comes empty { var personalDtos = _personalService.GetAllPersonalByFilters(1, string.Empty); return Json(personalDtos); } [HttpPost] public ActionResult Grid_Create(PersonalDto dto)//<--- comes empty{ var personalDtos = _personalService.GetAllPersonalByFilters(1, string.Empty); return Json(personalDtos); }
var grid = Html.Telerik().Grid<
StaffRoleGridItem
>()
.Name("OStaffRoles")
.DataBinding(db =>
{
db.Ajax()
.Select("_ListUsers", "Ajax", new { type = Model.Type });
})
.Columns(c =>
{
c.Bound(o => o.Id).Hidden();
c.Bound(o => o.Name).Title("User/Group Name");
c.Bound(o => o.Role).Title("Role in Project");
});
if ((POModel.ViewMode)ViewBag.Mode == PMOBaseModel.ViewMode.CREATE)
{
grid
.DataKeys(keys => keys.Add(o => o.Id))
.ToolBar(cmd =>
{
cmd.Insert().ButtonType(GridButtonType.Text).ImageHtmlAttributes(new { style = "margin-left: 0" }).Text("Add New Role");
})
.DataBinding(db =>
{
db.Ajax()
.Insert("_InsertUser", "Ajax", new { type = Model.Type })
.Update("_EditUser", "Ajax", new { type = Model.Type })
.Delete("_DeleteUser", "Ajax", new { type = Model.Type });
})
.Columns(c =>
{
c.Command(cmd =>
{
cmd.Edit().ButtonType(GridButtonType.Text);
cmd.Delete().ButtonType(GridButtonType.Text);
}).Width(190);
})
.Editable(e => e.Mode(GridEditMode.InLine))
.ClientEvents(ev => ev.OnEdit("onRoleEdit"));
}
grid.Render();