I want to add rows to my grid in the following code:
addButton.click(function (event) {
var rows = $("#Grid").jqxGrid('getrows');
if (rows.length != 5) {
if (!addButton.jqxButton('disabled')) {
var dat=null;
// add new empty row.
if (rows.length != 0) {
var d = rows[rows.length - 1].Date;
if (typeof (d) == "string") {
var dat = new Date(d
.substr(0, 4) +
"-" +
d.substr(5, 2) +
"-" +
d.substr(8, 2));
} else {
dat = d;
}
dat.setDate(dat.getDate() + 1);
}
$("#Grid").jqxGrid('addRow', null, { Date: dat });
}
}
});
I would like to add 1 day to the previous rows Date value.
It’s work perfectly for the first insert, but in the second, it’s change the first added row’s Date value too.
Example:
2016-05-04
2016-05-05
Click Add button
2016-05-04
2016-05-05
2016-05-06
Click Add button again
2016-05-04
2016-05-05
2016-05-07
2016-05-07