<ej:Grid ID="FlatGrid" runat="server" AllowPaging="True" AllowScrolling="True" AllowFiltering="False" AllowReordering="False" AllowSorting="True" AllowSelection="True" Selectiontype="Multiple" >
<ClientSideEvents QueryCellInfo="queryCellInfo" />
<Columns>
<ej:Column Field="Id" HeaderText="Order ID" Width="90" IsPrimaryKey="True" Visible="false" />
<ej:Column Field="Name" HeaderText="Customer ID" Width="85"/>
<ej:Column Field="OrderDate" HeaderText="Employee ID" Width="70"/>
</Columns>
</ej:Grid>
<script>
function queryCellInfo(args) {
if (args.column.field == "OrderDate") {
if (args.cell.textContent == null || args.cell.textContent == ""){
var val = "00/00/0000 00:00";
args.cell.textContent = val;
}
}
}
</script> |
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" >
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right" Width="90">
</ej:Column>
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="90">
<EditTemplate Create="create" Read="read" Write="write" />
</ej:Column>
. . .
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
</ej:Grid>
</div>
<script>
function create() {
return $("<input>");
}
function write(args) {
var proxy = args;
var record = args.data;
if (!args.element.closest("#gridEditForm").hasClass("e-waitingpopup"))
args.element.closest("#gridEditForm").ejWaitingPopup();
args.element.closest("#gridEditForm").ejWaitingPopup("show")
$.ajax({
type: "POST",
url: "/Default.aspx/Data2",
dataType: "json",
contentType: 'application/json; charset=utf-8',
success: function (data) {
var dropData = data.d;
var dropData = data.d;
args.element.ejAutocomplete({
width: "100%", dataSource: dropData, emptyResultText: 'No hay sugerencias', enableAutoFill: false, highlightSearch: true, allowFiltering: true, filterType: "Contains", fields: { text: "text", key: "value" },
,value: proxy.rowdata.CustomerID , watermarkText: "Select Product Code"
});
}
});
}
function read(args) {
args.ejAutocomplete('suggestionList').css('display', 'none');
return args.ejAutocomplete("getValue");
}
</script> |
<ej:Grid ID="grdVisitPool" ………….>
<DataManager URL="Default.aspx/UrlDataSource" UpdateURL="Default.aspx/URLUpdate" InsertURL="Default.aspx/UrlInsert" Adaptor="WebMethodAdaptor" />
……………………………….
<EditSettings AllowEditing="true" />
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="75" />
<ej:Column Field="ShipCity" HeaderText="Linea Transportista" AllowEditing="true" Tooltip="#colTip">
<EditTemplate Create="create" Read="read" Write="write" />
</ej:Column>
……………………….
</Columns>
</ej:Grid>
<script>
function create() {
return $("<input>");
}
function write(args) {
$.ajax(
{
type: "POST",
……………………………………….
url: 'Default.aspx/GetCarriers',
dataType: 'json',
success: function (data) {
args.element.ejAutocomplete({
dataSource: data.d,
width: "100%", watermarkText: "Seleccione un Transportista", emptyResultText: 'Sin sugerencias', enableDistinct: true,
highlightSearch: true, enableAutoFill: true
});
},
});
}
function read(args) {
args.ejAutocomplete('suggestionList').css('display', 'none');
return args.ejAutocomplete("getValue");
}
……………………
</script> |
<ej:Grid ID="grdVisitPool" ClientIDMode="Static" runat='server' AllowSorting="true" AllowPaging="true" Locale="es-ES" AllowScrolling="true">
…………………………..
<ClientSideEvents ActionComplete="onActionComplete" ActionBegin="onActionBegin" QueryCellInfo="queryCellInfo" />
<ScrollSettings Height="auto" Width="auto" EnableTouchScroll="true" />
<EditSettings AllowEditing="true" />
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="75" />
<ej:Column Field="ShipCity" HeaderText="Linea Transportista" AllowEditing="true" Tooltip="#colTip">
<EditTemplate Create="create" Read="read" Write="write" />
</ej:Column>
<ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" AllowEditing="true" Width="75" />
………………………………..
</Columns>
</ej:Grid>
<script>
…………………………….
function onActionComplete(args) {
if (args.requestType == "beginedit") {
$("#<%= grdVisitPool.ClientID %>EmployeeID").addClass("e-disable"); // add the disable class.
$("#<%= grdVisitPool.ClientID %>EmployeeID").attr("disabled", true) // set the disabled property as true.
}
}
function onActionBegin(args) {
if (args.requestType == "save") {
if (args.rowData.ShipCity == "Berlin") { // check the autoComplete field data here.
args.rowData.EmployeeID = 34; // based on the autoComplete field data set the desire value for another column here.
}
}
}
</script>
|