Hi!
I have bee through a lot of threads regarding this but I'm not able to find a dependable working solution. My case is that
- It is pure JS grid
- The grid is bound to local JS array
- It is not in batch mode
- The toolbar only allows adding new record
- Once a row is added, it is in full edit mode and the command buttons read: Update and Cancel
- Once I press update to save the row, it leaves edit template and the commands read: Edit and Delete
Here is the basic code to create the grid.
var
kendoDataSource =
new
kendo.data.DataSource({
data: getDataForGrid(),
pageSize: 5,
schema: {
model: {
id:
"ParkingServiceId"
,
fields: {
ParkingServiceId: { type:
'number'
, editable:
false
},
TerminalId: { type:
'number'
, validation: { required:
true
} },
ServiceId: { type:
'number'
, validation: { required:
true
} },
ParkingCardNumber: { type:
'string'
},
ParkingCardIssueDate: { type:
'date'
, validation: { required:
true
} },
ParkingCardExpiryDate: { type:
'date'
, validation: { required:
true
} },
ParkingCardGroupId: { type:
'number'
},
ServiceFee: { type:
'number'
, validation: { min: 0, required:
true
}, editable:
false
}
}
}
}
});
var
gridMain = $(
"#serviceDetailsGrid"
).kendoGrid({
dataSource: kendoDataSource,
pageable:
false
,
sortable:
false
,
toolbar: [
"create"
],
columns:
[
{ field:
"TerminalId"
, title:
"Terminal"
, width: 140, template: getTerminalTitle, editor: terminalDropDownEditor },
{ field:
"ServiceId"
, title:
"Service"
, template: getServiceTitle, editor: serviceDropDownEditor },
{ field:
"ParkingCardIssueDate"
, title:
"Issued On"
, width: 152, template:
"#= kendo.toString(kendo.parseDate(ParkingCardIssueDate, 'dd-MMM-yyyy'), 'dd-MMM-yyyy') #"
, format:
"{0:dd-MMM-yyyy}"
},
{ field:
"ParkingCardExpiryDate"
, title:
"Expiry"
, width: 152, template:
"#= kendo.toString(kendo.parseDate(ParkingCardExpiryDate, 'dd-MMM-yyyy'), 'dd-MMM-yyyy') #"
, format:
"{0:dd-MMM-yyyy}"
},
{ field:
"ParkingCardGroupId"
, title:
"Area"
, width: 100, template: getTerminalAreaTitle, editor: terminalAreaDropDownEditor },
{ field:
"ParkingCardNumber"
, title:
"Card #"
, width: 120 },
{ field:
"ServiceFee"
, title:
"Fee"
, width: 100 },
{ command: [{ name:
"edit"
}, { name:
"destroy"
}], title:
" "
, width:
"100px"
}
],
editable:
"inline"
,
cancel:
function
() { $(
'#serviceDetailsGrid'
).data(
'kendoGrid'
).dataSource.cancelChanges(); },
dataBound:
function
() {
var
innerContentU = $(
".k-grid-update"
).html();
if
(innerContentU) {
$(
".k-grid-update"
).html(innerContentU.replace(
"Update"
,
""
));
}
var
innerContentC = $(
".k-grid-cancel"
).html();
if
(innerContentC) {
$(
".k-grid-cancel"
).html(innerContentC.replace(
"Cancel"
,
""
));
}
var
innerContentD = $(
".k-grid-delete"
).html();
if
(innerContentD) {
$(
".k-grid-delete"
).html(innerContentD.replace(
"Delete"
,
""
));
}
var
innerContentE = $(
".k-grid-edit"
).html();
if
(innerContentE) {
$(
".k-grid-edit"
).html(innerContentE.replace(
"Edit"
,
""
));
}
}
}).data(
"kendoGrid"
);
I still see UPDATE, CANCEL, DELETE, and EDIT text. I have tried the following:
- http://www.telerik.com/forums/how-to-show-image-only-button-for-destroy-command-button#nZn3GJ0jUUmKUCnHtaZp5Q
- http://www.telerik.com/forums/image-only-on-command-buttons#-HlVbGjcFUKCnJ9Elngmew
- https://onabai.wordpress.com/2012/09/05/kendoui-grid-toolbar-button-with-icon-only/