Suppose in a form a panel '#main' content is loaded by executing following code :
$('#main').panel('refresh','contents.html');Now this contents.html contains 2 easyui-datebox. I want to initialize those box with some date (not current date). Where I have to put javascript code?
If I put is this way it never executes.
$(function(){
var dt = new Date();
var y = dt.getFullYear();
$('#year').numberspinner({
min: 2015,
max: 2030,
value: y,
editable: false
});
var Y1 = $('#year').numberspinner('getValue');
var Y2 = parseInt(Y1)+1;
var dfrom = '04' + '/' + '01' + '/' + Y1 ;
var dto = '03' + '/' + '31' + '/' + Y2 ;
alert(dfrom+'-'+dto);
$('#dtFrom').datebox('setValue',dfrom); //<- Enabling this line restricts rending the entire panel
$('#dtTo').datebox('setValue',dto); //<- Enabling this line restricts rending the entire panel
});
But if I put it directly under <script></script> tag it executes as follows:
var dt = new Date();
var y = dt.getFullYear();
$('#year').numberspinner({
min: 2015,
max: 2030,
value: y,
editable: false
});
var Y1 = $('#year').numberspinner('getValue');
var Y2 = parseInt(Y1)+1;
var dfrom = '04' + '/' + '01' + '/' + Y1 ;
var dto = '03' + '/' + '31' + '/' + Y2 ;
alert(dfrom+'-'+dto);
$('#dtFrom').datebox('setValue',dfrom); //<- Enabling this line restricts rending the entire panel
$('#dtTo').datebox('setValue',dto); //<- Enabling this line restricts rending the entire panel
But if I initialize those datebox, rendering of datebox is not done.
Please show me the correct way to initialize datebox in the contents.htm when it will be loaded under any panel using refresh method.