EasyUI Forum
December 08, 2025, 12:57:30 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datebox setValue not work and datagrid?  (Read 19594 times)
baxter
Newbie
*
Posts: 32


View Profile Email
« on: September 10, 2012, 01:49:39 AM »

I will set a default value in my dateboxes:

Code:
 
<div id="tbExpAccountingData" style="height: auto; padding: 10px;">
        <span style="margin-bottom: 5px; display: block;">
                <label for="date" style="float: left; width: 130px; font-weight: bold;"><strong>{%TPL['LG']['LG']['704']%}:</strong></label>
                {%TPL['LG']['LG']['06']%}<input id="ExpFromDate" class="easyui-datebox"></input>
        </span>
    </div>

When i set the SetValue Statement in my js file

Code:
$('document').ready(function() { 
    $('#ExpFromDate').datebox('setValue', '6/1/2012');
});

The value isn´t set and the datagrid isn´t loading the data. (in my tabs do not loading too) If i remove the datebox SetValue the datagrid loads fine. (and in my tabs)
Logged
ejzhang
Jr. Member
**
Posts: 61



View Profile
« Reply #1 on: October 18, 2012, 12:57:34 AM »

I encountered the same problem, please tell me how to do, thanks!
Logged
ejzhang
Jr. Member
**
Posts: 61



View Profile
« Reply #2 on: October 18, 2012, 01:18:25 AM »

Code:
	var $beginDate = $('#beginDate'), $endDate = $('#endDate');
with(new Date){
$beginDate.val(getFullYear()+"-"+(getMonth()+1)+"-01");
$endDate.val(getFullYear()+"-"+(getMonth()+1)+"-"+getDate());
}
$beginDate.datebox({
parser: function(date){
var arrDate = date.match(/(\d{4})[-/](\d{1,2})[-/](\d{1,2})/);
if(arrDate){
return new Date(parseInt(arrDate[1],10), parseInt(arrDate[2],10)-1, parseInt(arrDate[3],10));
} else {
return new Date();
}
},
formatter: function(date){
$beginDate.val(date.getFullYear()+'-'+(date.getMonth()<9?'0':'')+(date.getMonth()+1)+'-'+(date.getDate()<10?'0':'')+date.getDate());
return date.getFullYear()+'-'+(date.getMonth()<9?'0':'')+(date.getMonth()+1)+'-'+(date.getDate()<10?'0':'')+date.getDate();
}
});
$endDate.datebox({
parser: function(date){
var arrDate = date.match(/(\d{4})[-/](\d{1,2})[-/](\d{1,2})/);
if(arrDate){
return new Date(parseInt(arrDate[1],10), parseInt(arrDate[2],10)-1, parseInt(arrDate[3],10));
} else {
return new Date();
}
},
formatter: function(date){
$endDate.val(date.getFullYear()+'-'+(date.getMonth()<9?'0':'')+(date.getMonth()+1)+'-'+(date.getDate()<10?'0':'')+date.getDate());
return date.getFullYear()+'-'+(date.getMonth()<9?'0':'')+(date.getMonth()+1)+'-'+(date.getDate()<10?'0':'')+date.getDate();
}
});
I did it!
« Last Edit: October 18, 2012, 01:20:03 AM by ejzhang » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!