|
<ej:Grid ID="Grid1" runat="server" AllowPaging="True" DataSourceID="test34" ClientIDMode="AutoID" OnServerAddRow="Grid1_ServerAddRow" AllowCellMerging="true" AllowGrouping="true" OnServerEditRow="Grid1_ServerEditRow" AllowSorting="true">
<ClientSideEvents ActionBegin="onbegin" MergeHeaderCellInfo="mergeHead" RowSelected="rowselect" TemplateRefresh="template" />
…...
<Columns>
<ej:Column Field="memberId" Width="100px" IsPrimaryKey="true"/>
…...
<ej:Column Field="checkColumnA" TemplateID="#testA" Template="true" Width="50px">
<EditTemplate Create="createcheckA" Read="readcheckA" Write="writecheckA"/></ej:Column>
<ej:Column Field="checkColumnB" TemplateID="#testB" Template="true" Width="50px">
<EditTemplate Create="createcheckB" Read="readcheckB" Write="writecheckB"/></ej:Column>
</Columns>
</ej:Grid>
<script>
function createcheckA(args){
return $("<input>");
}
function writecheckA(args) {
if(args.rowdata.checkColumnA == "Y"){
args.element.ejCheckBox({checked :true,
---------------
}
});
}
else if(args.rowdata.checkColumnA == "N"){
args.element.ejCheckBox({
checked: false,
--------------
}
});
}
}
function readcheckA(args) {
if (args.ejCheckBox("isChecked"))
return "Y";
else
return "N";
}
function createcheckB(args) {
return $("<input>");
}
function writecheckB(args) {
if (args.rowdata.checkColumnB == "Y") {
args.element.ejCheckBox({
checked: true,
--------------------
});
}
else if (args.rowdata.checkColumnB == "N") {
args.element.ejCheckBox({
checked: false,
------------------------------
});
}
}
function readcheckB(args) {
if (args.ejCheckBox("isChecked"))
return "Y";
else
return "N";
}
</script> |
|
<script>
function createcheckA(args){
return $("<input>");
}
function writecheckA(args) {
if(args.rowdata.checkColumnA == "Y"){
args.element.ejCheckBox({checked :true,
change: function (e) {
if (e.isChecked) {
$("#ctl00_MainContent_ucPerson1_Grid1startDate").prop("disabled", true);
$("#ctl00_MainContent_ucPerson1_Grid1startDate").addClass("e-disable");
}
else {
$("#ctl00_MainContent_ucPerson1_Grid1startDate").prop("disabled", false);
$("#ctl00_MainContent_ucPerson1_Grid1startDate").removeClass("e-disable");
}
}
});
}
else if(args.rowdata.checkColumnA == "N"){
args.element.ejCheckBox({
checked: false,
change: function (e) {
if(e.isChecked){
$("#ctl00_MainContent_ucPerson1_Grid1startDate").prop("disabled", true);
$("#ctl00_MainContent_ucPerson1_Grid1startDate").addClass("e-disable");
}
else {
$("#ctl00_MainContent_ucPerson1_Grid1startDate").prop("disabled",false);
$("#ctl00_MainContent_ucPerson1_Grid1startDate").removeClass("e-disable");
}
}
});
}
}
function createcheckB(args) {
return $("<input>");
}
function writecheckB(args) {
if (args.rowdata.checkColumnB == "Y") {
args.element.ejCheckBox({
checked: true,
change: function (e) {
if (e.isChecked) {
$("#ctl00_MainContent_ucPerson1_Grid1endDate").prop("disabled", true);
$("#ctl00_MainContent_ucPerson1_Grid1endDate").addClass("e-disable");
}
else {
$("#ctl00_MainContent_ucPerson1_Grid1endDate").prop("disabled", false);
$("#ctl00_MainContent_ucPerson1_Grid1endDate").removeClass("e-disable");
}
}
});
}
else if (args.rowdata.checkColumnB == "N") {
args.element.ejCheckBox({
checked: false,
change: function (e) {
if (e.isChecked) {
$("#ctl00_MainContent_ucPerson1_Grid1endDate").prop("disabled", true);
$("#ctl00_MainContent_ucPerson1_Grid1endDate").addClass("e-disable");
}
else {
$("#ctl00_MainContent_ucPerson1_Grid1endDate").prop("disabled", false);
$("#ctl00_MainContent_ucPerson1_Grid1endDate").removeClass("e-disable");
}
}
});
}
}
</script> |
| <script> function createcheckA(args){ return $("<input>"); } function writecheckA(args) { if (args.requestType == "add") { args.element.ejCheckBox() } if(args.rowdata.checkColumnA == "Y"){ args.element.ejCheckBox({checked :true, change: function (e) { . . . . . } }); } else if(args.rowdata.checkColumnA == "N"){ args.element.ejCheckBox({ checked: false, . . . . . . }); } } function readcheckA(args) { if (args.ejCheckBox("isChecked")) return "Y"; else return "N"; } function createcheckB(args) { return $("<input>"); } function writecheckB(args) { if (args.requestType == "add") { args.element.ejCheckBox() } if (args.rowdata.checkColumnB == "Y") { args.element.ejCheckBox({ checked: true, . . . . . . } }); } else if (args.rowdata.checkColumnB == "N") { args.element.ejCheckBox({ checked: false, . . . . . . }); } } function readcheckB(args) { if (args.ejCheckBox("isChecked")) return "Y"; else return "N"; } </script> |
| |
| <ej:Grid ID="Grid1" runat="server" AllowPaging="True" DataSourceID="test34" ClientIDMode="AutoID" OnServerAddRow="Grid1_ServerAddRow" AllowCellMerging="true" AllowGrouping="true" OnServerEditRow="Grid1_ServerEditRow" AllowSorting="true"> <EditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" EditMode="DialogTemplate" DialogEditorTemplateID="#temp" /> <PageSettings ShowDefaults="true" PageSize="2" Template="#pageSizeLOATmp" EnableTemplates="true" /> <ClientSideEvents ActionBegin="onbegin" MergeHeaderCellInfo="mergeHead" RowSelected="rowselect" ActionComplete="onGridActionCompleteEvent" BeforePrint="printLOA"/> <ToolbarSettings ToolbarItems="add,edit,delete,update,cancel" ShowToolbar="true"></ToolbarSettings> <Columns> <ej:Column Field="memberId" Width="100px" IsPrimaryKey="true"/> <ej:Column Field="first_name" Type="string" Width="80px" > </ej:Column> …... function onGridActionCompleteEvent(args) { $("#" + args.model.clientId).prepend($(".PrintHeaderLOA")); pageSetting(args, "LOA"); if (args.requestType == "beginedit" || args.requestType == "add") { …... if (args.model.editSettings.editMode == "dialogtemplate") { $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#checkColumnA").ejCheckBox({ change: "checkchange" }); $.ajax({ type: "POST", url: "Default.aspx/DropDown", contentType: "application/json; charset=utf-8", dataType: "json", success: function (value) { $("#priceId").ejDropDownList({ dataSource: value.d, fields: { value: "priceId", text: "price1" }, width: "100%" }); }, error: function (e) { alert(e); } }); } } } function checkchange(args) { if (args.isChecked == false) { $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").removeClass("e-disable"); } else if (args.isChecked == true) { $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").addClass("e-disable"); } } |
| function onGridActionCompleteEvent(args) { if (args.requestType == "beginedit" || args.requestType == "add") { …... if (args.model.editSettings.editMode == "dialogtemplate") { $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#checkColumnA").ejCheckBox({ change: "checkchange" }); var checkstate = $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#checkColumnA").ejCheckBox("isChecked"); if (checkstate) { $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").addClass("e-disable") $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").attr("disabled", true); } else { $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").removeClass("e-disable"); $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").attr("disabled",false); } $.ajax({ type: "POST", url: "Default.aspx/DropDown", contentType: "application/json; charset=utf-8", dataType: "json", success: function …... |
|
<script type="text/template" id="temp">
<table>
<tr>
<td>startDate</td>
<td> <input id="startDate" name="startDate" value="{{: startDate}}" disabled="disabled"
class="e-field e-ejinputtext valid e-disable" style="text-align: right; width: 116px; height: 28px" />
</td>
<td>
{{if checkColumnA == 'Y'}}
<input type="checkbox" class="check" checked id="checkColumnA" />
{{else}}
<input type="checkbox" class="check" id="checkColumnA" disabled/>
{{/if}}
</td>
</tr>
</table>
</script>
function onGridActionCompleteEvent(args) {
if (args.requestType == "beginedit" || args.requestType == "add") {
…...
if (args.model.editSettings.editMode == "dialogtemplate") {
$("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#checkColumnA").ejCheckBox({ change: "checkchange" });
var checkstate = $("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#checkColumnA").ejCheckBox("isChecked");
if (checkstate) {
$("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").addClass("e-disable")
$("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").attr("disabled", true);
}
else {
$("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").removeClass("e-disable");
$("#ctl00_MainContent_ucPerson1_Grid1EditForm").find("#startDate").attr("disabled",false);
}
$.ajax({
type: "POST",
url: "Default.aspx/DropDown",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (value) {
$("#priceId").ejDropDownList({
dataSource: value.d,
fields: { value: "priceId", text: "price1" },
width: "100%"
});
},
error: function (e) {
alert(e);
}
});
}
}
} |