87,922
社区成员
发帖
与我相关
我的任务
分享
<form name="f1" action="outlets_init.php" method="post" >
<input type="text" class="easyui-datebox" id="bt" name="bt" value=<?php echo date('Y-m-d',strtotime('-7 day'))?>>
--to--<input type="text" class="easyui-datebox" id="et" name='et' value=<?php echo date('Y-m-d',time())?>>
<input type="submit" value="go" >
</form>
<br>
<p>default show last 7 days</p>
<br>
<div id="showR" >
</div>
<div id="initD" style="display: display">
<table id="xxoo" class="easyui-datagrid" title="outlets_daily_sales" style="width:890px;height:auto"
data-options="
singleSelect: true,
url: 'outlets_init.php',
rowStyler: function(index,row){
if (row.outdate == 'TOTAL'){
return 'background-color:#6293BB;color:#fff;font-weight:bold;';
}
}
">
<thead>
<tr>
<th data-options="field:'outdate',width:80">outdate</th>
<th data-options="field:'Qingpu',width:80">Qingpu</th>
<th data-options="field:'Wuxi',width:80">Wuxi</th>
<th data-options="field:'Foxtown',width:80">Foxtown</th>
<th data-options="field:'Suzhou',width:80">Suzhou</th>
<th data-options="field:'Beijing',width:60">Beijing</th>
<th data-options="field:'Shenyang',width:80">Shenyang</th>
<th data-options="field:'Xiamen',width:80">Xiamen</th>
<th data-options="field:'Chongqing',width:80">Chongqing</th>
<th data-options="field:'Chengdu',width:80">Chengdu</th>
<th data-options="field:'day_total',width:80">day_total</th>
</tr>
</thead>
</table>
<script >
$('#xxoo').datagrid('reload');
</script>
ob_start();
require_once 'DB_sybase.php';
ob_end_clean();
$db=DB::Connect();
$start_date = isset($_POST['bt']) ? str_replace('-','',$_POST['bt']) :str_replace('-','',date('Y-m-d',strtotime('-7 day')));
$end_date = isset($_POST['et']) ? str_replace('-', '',$_POST['et']) :str_replace('-','',date('Y-m-d',time()));
$result=$db->Q_init($start_date,$end_date);
$c1=0;
$c2=0;
$c3=0;
$c4=0;
$c5=0;
$c6=0;
$c7=0;
$c8=0;
$c9=0;
$result2 = array();
$items=array();
while($row1= sybase_fetch_array($result)){
$c1=$c1+$row1[1];
$c2=$c2+$row1[2];
$c3=$c3+$row1[3];
$c4=$c4+$row1[4];
$c5=$c5+$row1[5];
$c6=$c6+$row1[6];
$c7=$c7+$row1[7];
$c8=$c8+$row1[8];
$c9=$c9+$row1[9];
}
$result=$db->Q_init($start_date,$end_date);
while($row2= sybase_fetch_array($result)){
$row2['day_total']=$row2[1]+$row2[2]+$row2[3]+$row2[4]+$row2[5]+$row2[6]+$row2[7]+$row2[8];
array_push($items, $row2);
}
$items_sum=array('outdate'=>'TOTAL','Qingpu'=>$c1,'Foxtown'=>$c2,'Wuxi'=>$c3,
'Suzhou'=>$c4,'Beijing'=>$c5,'Shenyang'=>$c6,'Xiamen'=>$c7,'Chongqing'=>$c8,'Chengdu'=>$c9,
'day_total'=>$c1+$c2+$c3+$c4+$c5+$c6+$c7+$c8+$c9
);
array_push($items, $items_sum);
$result2["rows"] = $items;
echo json_encode($result2);
<form name="f1" action="outlets_init.php" method="post" >
<input type="text" class="easyui-datebox" id="bt" name="bt" value=<?php echo date('Y-m-d',strtotime('-7 day'))?>>
--to--<input type="text" class="easyui-datebox" id="et" name='et' value=<?php echo date('Y-m-d',time())?>>
<input type="button" id="but" value="go" >
</form>
<br>
<script >
jQuery(document).ready(function(){
$('#but').click(function(){
$('#xxoo').datagrid('reload',{st:$('#bt').datebox('getValue'),et:$('#et').datebox('getValue')});
});
});
</script>
[/quote]
alert能正确弹出$('#bt').datebox('getValue')的值,是不是传到后台的过程有问题?<form name="f1" action="outlets_init.php" method="post" >
<input type="text" class="easyui-datebox" id="bt" name="bt" value=<?php echo date('Y-m-d',strtotime('-7 day'))?>>
--to--<input type="text" class="easyui-datebox" id="et" name='et' value=<?php echo date('Y-m-d',time())?>>
<input type="button" id="but" value="go" >
</form>
<br>
<script >
jQuery(document).ready(function(){
$('#but').click(function(){
$('#xxoo').datagrid('reload',{st:$('#bt').datebox('getValue'),et:$('#et').datebox('getValue')});
});
});
</script>
$('#xxoo').datagrid('reload',{st:$('开始日期选择器').datebox('getValue'),et:$('结束日期选择器').datebox('getValue')});
你的应该是datebox组件,如果不行改成对应的组件名称