Currently when you edit a grid row you are presented with two buttons/actions related to the row that is being edited - Done and Cancel. Is it possible to add another button/action? I would like to add a button that would populate editable fields with default values specified outside of the grid. If this is possible could you please provide a sample? Many Thanks.
Hello,
I am glad you have managed to resolve your issue. If you need any further assistance with this please let me know.
for others...
Instead of
editRowStarted: function (evt, ui) { $(".ui-iggrid-buttoncontainer").css("margin-left", "980px")
// inserts DOm element via .append method if ($("#btnUpdateValues").length == 0) { $(".ui-iggrid-buttoncontainer").append("<span id='btnUpdateValues'></span>"); $("#btnUpdateValues").addClass("ui-iggrid-button ui-state-default ui-corner-all"); $("#btnUpdateValues").append("<span style='display: inline-block; padding: 3px 10px 5px 10px;'>Update</span>") }
// updates the row with predefined values that are holded in the rowValues object $("#btnUpdateValues").on("click", function () { $("#grid").igGridUpdating("updateRow", ui.rowID, rowValues); });}
it needs to be...
rowIndex = ui.rowID;
// updates the row with predefined values that are holded in the rowValues object $("#btnUpdateValues").on("click", function () { $("#grid").igGridUpdating("updateRow", rowIndex, rowValues); });}
I found the mistake, thank you!
Rick
Hi Hristo,
Here is my code... Thanks.
$("#grid").igGrid({
primaryKey: "learnerId",
columns: [
{ headerText: "LearnerId", key: "learnerId", dataType: "number", template: "${learnerId}", width: 60, hidden: true },
{ headerText: "Last Name", key: "lastName", dataType: "string", template: "${lastName}", width: 150 },
{ headerText: "First Name", key: "firstName", dataType: "string", template: "${firstName}", width: 150 },
{ headerText: "Date Completed", key: "dateCompleted", dataType: "date", template: "${dateCompleted}", width: 120 },
{ headerText: "Score", key: "score", dataType: "string", template: "${score}", width: 80 },
],
autoGenerateColumns: false,
dataSource: data,
updateUrl: PostbackInfo.GridPostbackUrl,
dataRendered: function (evt, ui) {
ui.owner.element.find("tr td:nth-child(4)").css("text-align", "center");
ui.owner.element.find("tr td:nth-child(5)").css("text-align", "center");
},
features: [
{
name: "Updating",
enableAddRow: false,
enableDeleteRow: false,
editMode: "row",
responseDataKey: "results",
columnSettings: [
{ columnKey: "lastName", readOnly: true },
{ columnKey: "firstName", readOnly: true },
{ columnKey: "dateCompleted", editorType: "datepicker", required: true },
{ columnKey: "score", editorType: "numeric", required: true, dataMode: "int",
editorOptions: {
button: "spin",
minValue: 0,
maxValue: 100
}
editRowStarted: function (evt, ui) {
$(".ui-iggrid-buttoncontainer").css("margin-left", "480px")
// inserts DOm element via .append method
if ($("#btnApplyDefaults").length == 0) {
$(".ui-iggrid-buttoncontainer").append("<span id='btnApplyDefaults'></span>");
$("#btnApplyDefaults").addClass("ui-iggrid-button ui-state-default ui-corner-all");
$("#btnApplyDefaults").append("<span style='display: inline-block; padding: 3px 10px 5px 10px;'>Apply Defaults</span>")
// updates the row with predefined values that are holded in the rowValues object
$("#btnApplyDefaults").on("click", function () {
$("#grid").igGridUpdating("updateRow", ui.rowID, { 'score': '100', 'dateCompleted': '11/14/2014' });
});
}]
Hello Rick,
The sample provided does not reproduce this behavior, this makes me believe the issue lies in your code. Please provide your code or sample so that I could be able to investigate this for you.