I have a scenario where I need a way for the user to cancel an insert once they have chose to insert a new row.
The configuration is InCell editing with a custom "save" button and a custom "add" on top of the view. So the grid is in batch edit mode and is working fine other than when the user decides to insert a row. If I place a default "Cancel" command that cancel button will be in every row. That is one problem.
So I decided to have a hidden column at the end of the grid with a client template containing a "Cancel" button.
When they insert a new row I hook the onEdit event of the grid and make the column visible. But in doing so all of the column widths get whacked out. I searched a bit to find a resize row method but it is not working.
function
resizeColumnDefaults() {
debugger;
resize(0, 250);
resize(2, 100);
resize(3, 100);
resize(5, 100);
resize(6, 100);
resize(8, 120);
resize(9, 300);
resize(10, 75);
resize(11, 75);
resize(13, 75);
}
function
resize(idx, width) {
$(
"#Grid .k-grid-header-wrap"
)
//header
.find(
"colgroup col"
)
.eq(idx)
.css({ width: width });
$(
"#Grid .k-grid-content"
)
//content
.find(
"colgroup col"
)
.eq(idx)
.css({ width: width });
}
function
onEdit(e) {
var
grid = $(
"#Grid"
).data(
"kendoGrid"
);
grid.showColumn(11);
resizeColumnDefaults();
}
Can someone offer a solution?
Thanks,
Reid