//Create instance for the grid var gridObj = $("#FlatGrid").data("ejGrid"); //Adding record to the grid gridObj.addRecord({ Id: 5, Name: "asdfsdf", EmpId: 4 }); |
//Getting index of the lastrecord var index = $("#FlatGrid").find(".e-lastrowcell").parent().index(); var data = gridObj.model.currentViewData[index]; gridObj.deleteRecord("Id", { Id: data.Id, EmpId: data.EmpId }); |
1. Please share us the screenshot of your requirement with multiple grid like before add the record ,after added the record and after delete the record, etc..
2. Provide us detailed description of your requirement / complete procedure of your requirement.
3. And also share the details that the add/delete operations will perform in all the grid in single button click or add the records in one grid will delete the record in other grid.
4. Please provide more details about the requirement “simultaneously when i add the rows serial number also added in all grid” like screenshot.
The provided information will help us to analyze the requirement and provide you the response as early as possible.
Regards,
Gowthami V.
Hi Ganga,
We have checked the reported scenario with 13.1.0.21 and 13.2.0.34 versions but we are unable to reproduce the issue.
We have created a sample for adding a record by clicking an External Button (version 13.1.0.21) using “addRecord” method that you can download from the following link:
http://www.syncfusion.com/downloads/support/forum/119655/ze/MvcApplication66-2043555382
If we misunderstood your query, please provide below details,
1. Version details of the product of your application.
2. Code example (View and Controller) of your application.
3. Reproduce the reported issue in the above sample.
The provided information will help to analyze the issue and provide a solution as early as possible.
Regards,
Gowthami V.
Hi,
I am running 15.3460.0.26 and when I try to do addrecord, the grid does not show the row added when it is empty. After I click on the grid toolbar add button, 2 rows (include the one i previously added) shows up.
Below is my code
cript>
$(function () {
$("#Grid3").ejGrid({
dataSource: window.gridData,
isResponsive: true,
allowSorting: true,
allowSelection: true,
//allowAdding: true,
beginEdit: "beginEdit",
endDelete: "endDelete",
endAdd: "endAdd",
dataSourceCachingMode: "None",
actionFailure: "logerror",
//sortSettings: { sortedColumns: [{ field: "invoice_item_seq_id", direction: "ascending" }] },
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
columns: [
{ field: "invoice_item_seq_id", isPrimaryKey: "true", headerText: "S/N", textAlign: ej.TextAlign.Left, width: 20 },
{ field: "ref", headerText: "Part", textAlign: ej.TextAlign.Left, width: 40 },
{ field: "item_description", headerText: "Description", textAlign: ej.TextAlign.Left, width: 150 },
{ field: "quantity", headerText: "Qty", textAlign: ej.TextAlign.Center, width: 30 },
{ field: "currency_id", headerText: "Currency", textAlign: ej.TextAlign.Center, width: 30 },
{ field: "unit_price", headerText: "Unit Price", textAlign: ej.TextAlign.Center, width: 50 },
{ field: "cost", headerText: "Disc Amt", textAlign: ej.TextAlign.Center, width: 50 },
{ field: "taxable_flag", headerText: "Gst", textAlign: ej.TextAlign.Center, width: 30 },
{ field: "amount", headerText: "Amount", textAlign: ej.TextAlign.Right, width: 50 }
]
});
});
</script>
</div>
<script>
// Create grid object.
var row_count = 0;
var data_str = "";
function add_record(ref, name)
{
var gridObj = $("#Grid3").data("ejGrid");
// Sends an add new record request to the grid
row_count=row_count + 1
gridObj.addRecord({ "invoice_item_seq_id": row_count, "ref": ref, "item_description": name, "quantity": 1, "currency_id": "MYR", "unit_price": "0.00", "cost": "", "taxable_flag": "SR", "amount": 0.00 });
refresh_content();
}