If I add several rows to my grid which is not bound to any data source, upon clicking the edit button of the first row and then clicking then edit of any other row. The first row of the grid is lost/deleted if the update button is not clicked.
This only happens a single time and never again after the first time it occurs on any action combination.
Would be helpful to know if there is a way to send only new items through the create transport instead of the entire grid also.
I've tried setting the model id, this doesn't fix the problem either problem.
<
datasource
>
<
schema
>
<
model
id
=
"PrimaryId"
>
<
fields
>
<
field
name
=
"PrimaryId"
default-value
=
"1"
></
field
>
<
field
name
=
"PayDate"
type
=
"date"
editable
=
"true"
nullable
=
"false"
></
field
>
<
field
name
=
"ActivityStartDate"
type
=
"date"
editable
=
"true"
nullable
=
"false"
></
field
>
<
field
name
=
"ActivityEndDate"
type
=
"date"
editable
=
"true"
nullable
=
"false"
></
field
>
<
field
name
=
"ApprovalDeadlineDateTime"
type
=
"date"
editable
=
"true"
nullable
=
"false"
></
field
>
</
fields
>
</
model
>
</
schema
>
</
datasource
>
logic to get around incorrect rows sent to controller through create transport
if
(grid.dataSource.data().length == 0) {
//defaulted today
grid.addRow();
}
else
{
var
newStartDate = AddDays(grid.dataSource.data()[grid.dataSource.data().length - 1].ActivityEndDate,1);
var
newEndDate = AddDays(newStartDate, 30);
var
newDeadline = AddDays(newEndDate, 5);
var
newPayDate = AddDays(newDeadline, 2);
$(
"#PayrollPayRunGrid"
).data(
"kendoGrid"
).dataSource.pushInsert(grid.dataSource.data().length, {
PrimaryId: currId,
ActivityStartDate:newStartDate,
ActivityEndDate: newEndDate,
ApprovalDeadlineDateTime: newDeadline,
PayDate: newPayDate,
});
currId++;
grid.editRow($(
"#PayrollPayRunGrid tr:eq("
+ (grid.dataSource.data().length) +
")"
));
}