<div>
<table>
<tr>
<td>
<label>CustomerID:"</label>
<input type="text" name="customerID" placeholder="customerID">
</td>
</tr>
<tr>
<td>
<label>Ship City:</label>
<input type="text" name="Shipcity" placeholder="Shipcity">
</td>
</tr>
<tr>
<td>
<a rel='nofollow' href="#Save">Save</a>
</td>
<td>
<a rel='nofollow' href="#Edit">Edit</a>
</td>
<td>
<a rel='nofollow' href="#Delete">Delete</a>
</td>
</tr>
</table>
</div>
<div id="Content">
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True">
<Columns>
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80">
<ValidationRule>
<ej:KeyValue Key="required" Value="true" />
<ej:KeyValue Key="minlength" Value="3" />
</ValidationRule>
</ej:Column>
<ej:Column Field="ShipCity" HeaderText="Ship City" Width="80" />
</Columns>
</ej:Grid>
</div>
Thanks
Pratheep
<ej:Grid ID="OrdersGrid" ClientIDMode="Static" runat="server" AllowPaging="True">
<EditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" />
<Columns>
<ej:Column Field="OrderID" IsPrimaryKey="true" Width="80"></ej:Column>
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80">
<ValidationRule>
<ej:KeyValue Key="required" Value="true" />
<ej:KeyValue Key="minlength" Value="3" />
</ValidationRule>
</ej:Column>
<ej:Column Field="ShipCity" HeaderText="Ship City" Width="80" />
</Columns>
</ej:Grid> |
<a rel='nofollow' href="#Add" onclick="addEvent()">Add</a>
function addEvent() {
var gridObj = $("#OrdersGrid").data("ejGrid");
gridObj.addRecord({ "OrderID": 12333, "CustomerID": "vinet", "ShipCity": "berlin" }); //add record dynamically
//trigger addrecord - new row only added: you need to insert values
//gridObj.addRecord();
}
|
function addEvent() {
var gridObj = $("#OrdersGrid").data("ejGrid");
//trigger addrecord - new row only added: you need to insert values
gridObj.addRecord();
} |
function editEvent()
{
var gridObj = $("#OrdersGrid").data("ejGrid");
var index = gridObj.selectedRowsIndexes[0];
var rowEle = gridObj.getRowByIndex(index);
gridObj.startEdit(rowEle);
//for ex – Edit without select
//gridObj.startEdit($(".e-gridcontent tr").first());
} |
function saveEvent() {
var gridObj = $("#OrdersGrid").data("ejGrid");
gridObj.updateRecord("OrderID", { OrderID: 10004, EmployeeID: 3 });
} |
function saveEvent() {
var gridObj = $("#OrdersGrid").data("ejGrid");
gridObj.endEdit();
} |
function deleteEvent() {
var gridObj = $("#OrdersGrid").data("ejGrid");
var primaryKeyCol = gridObj.getPrimaryKeyFieldNames()[0];
var selectedRecord = gridObj.getSelectedRecords()[0];
gridObj.deleteRecord(primaryKeyCol, selectedRecord);
//for ex:
//gridObj.deleteRecord("OrderID", { OrderID: 10004, EmployeeID: 3 });
}
|
function deleteEvent() {
var gridObj = $("#OrdersGrid").data("ejGrid");
gridObj.deleteRecord("OrderID", { OrderID: 10004, EmployeeID: 3 });
}
|