|
<script type="text/javascript">
$(function () {
var beforePrint = function() {
var ddl = $('#skillsets').data("ejDropDownList");
var val = ej.isNullOrUndefined(ddl._hiddenValue) ? "" : ddl._hiddenValue;
ddl.wrapper.append("<span id='cont'>"+ val +"</span>");
ddl.container.css("display","none");
};
var afterPrint = function() {
var ddl = $('#skillsets').data("ejDropDownList");
ddl.container.css("display","");
$("#cont").remove();
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
});
</script> |
This worked great for the dropdownlist, however, we have the same issue for the datepicker and the maskedit controls as shown by the following code:
@Html.EJ().DatePicker("dpDatePicker").ReadOnly(disableControls).Value(@Model.DateOfBirth ?? DateTime.Today).DateFormat("dd-MMM-yyyy").CssClass("form-control").CssClass((disableControls) ? "customdisable" : "").Width("100%")
The issue is that the controls don't allow the <object>.container.css("display", "none"); to be applied.
Is there any suggestions for this? I thought I'd be able to extract your answer for the ddl, but it seems that it can't be applied and I'm unable to identify any way to convert it to work with those controls.
|
<script type="text/javascript">
$(function () {
var beforePrint = function () {
var dateobj = $("#datepick").ejDatePicker("instance");
var dateval = ej.isNullOrUndefined(dateobj.element.val()) ? "" : dateobj.element.val();
dateobj.wrapper.append("<span id='cont1'>" + dateval + "</span>");
dateobj.wrapper.find('.e-in-wrap.e-box').css('display', 'none');
};
var afterPrint = function () {
var dateobj = $("#datepick").ejDatePicker("instance");
dateobj.wrapper.find('.e-in-wrap.e-box').css('display', 'block');
$("#cont1").remove();
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
});
</script> |
|
var beforePrint = function () {
var obj = $("#Mask").ejMaskEdit("instance");
var val = ej.isNullOrUndefined(obj._hiddenInput.val()) ? "" : obj._hiddenInput.val();
obj.wrapper.append("<span id='cont'>" + val + "</span>");
obj.wrapper.find('.e-in-wrap.e-box').css('display', 'none')
};
var afterPrint = function () {
var obj = $("#Mask").ejMaskEdit("instance");
obj.wrapper.find('.e-in-wrap.e-box').css('display', 'block')
$("#cont").remove();
}; |