Home  >  Article  >  Backend Development  >  datagrid 动态生成列的有关问题

datagrid 动态生成列的有关问题

WBOY
WBOYOriginal
2016-06-13 11:52:26761browse

datagrid 动态生成列的问题
要求:根据用户选择的时间段动态生成列,如下

卡在了当用户选择时间段后点击‘go’按钮,该怎么修改datagrid中的列名?请大神用个简单的示例指点下
------解决方案--------------------


 data-options="url: 'get_salesquantityper.php', singleSelect: true,  rownumbers:true "      
 > 
 
 
Category
 
 


//include "t.php";
initRows1($x1, $x2);//initRows1方法正确输出
?>
 
 
initRows2($x1, $x2);
?> 
 
 


用个容器括起datagrid的容器,查询后清空容器里面easyui生成的datagrid代码,easyui没有提供更改columns配置的方法,也没有注销datagrid的方法,只能靠清空容器来移除datagrid了。如果你用的jqgrid有提供注销jqgrid的功能

点击查询
$('#dvDataGrid').html('<table id="salesquantityper"></table>')<br />//参考你另外的那个帖子,用ajax获取到columns的内容后重新调用$('#salesquantityper').datagrid()的方法生成datagrid对象加载columns新配和数据

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn