Title: datebox setValue not work and datagrid?
Post by: baxter on September 10, 2012, 01:49:39 AM
I will set a default value in my dateboxes: <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 $('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)
Title: Re: datebox setValue not work and datagrid?
Post by: ejzhang on October 18, 2012, 12:57:34 AM
I encountered the same problem, please tell me how to do, thanks!
Title: Re: datebox setValue not work and datagrid?
Post by: ejzhang on October 18, 2012, 01:18:25 AM
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!
|