如何解决如何编辑单元格Zfdatagrid
| 我如何使用带有zfdatagrid的ajax来编辑行,谢谢ZF 1.11 -
My Bootstrap
protected function _initZfdatagrid()
{
$this->_config = new Zend_Config_Ini(APPLICATION_PATH .\'/configs/grid.ini\',\'production\');
Zend_Registry::set(\'config\',$this->_config);
if ( @isset(Zend_Registry::get(\'config\')->site->jqgridUrl) ) {
Bvb_Grid_Deploy_Jqgrid::$defaultJqgridLibPath = Zend_Registry::get(\'config\')->site->jqgridUrl;
}
}
My Controller
public function indexAction()
{
$grid1 = new Bvb_Grid_Deploy_Jqgrid(Zend_Registry::get(\'config\'));
$this->configG1($grid1);
$grid1->setDeployOptions(array
(\'title\'=>\'Grado 10A\',\'subtitle\'=>\'School2.0 : Matematicas:\'.date(\'Y-m-d\'),\'logo\'=>$this->view->baseUrl.\'/zfdatagrid/public/images/logotipo.jpg\',));
$this->view->grid = $grid1->deploy();
$this->render(\'index\');
}
public function configG1 ($grid)
{
$select = $this->_db->select()->from(\'Articulos\',array(\'id\',\'titulo\',\'fecha\',\'nota\',\'publicar\',\'dependencia\'));
$grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
$grid->updateColumn(\'id\',array(\'title\' => \'#ID\',\'hide\' => true));
$grid->updateColumn(\'_action\',array(\'search\' => false,// this will disable search on this field
\'order\' => 1,\'title\' => \'Action\',\'width\' => 100,\'class\' => \'bvb_action bvb_first\',\'callback\' =>
array(\'function\' => array($this,\'g1ActionBar\'),\'params\' =>
array(\'{{ID}}\')),\'jqg\' =>
array(\'fixed\' => true,\'search\' => false)));
$grid->updateColumn(\'titulo\',array(\'title\' => \'Titulo Articulo\',\'width\' => 260));
$grid->updateColumn(\'fecha\',array(\'title\' => \'Fecha\',\'searchType\' => \"=\"));
$grid->updateColumn(\'Nota\',array(\'title\' => \'Calificacion (ucase)\',\'callback\' => array(\'function\' => create_function(\'$text\',\'return strtoupper($text);\'),\'params\' => array(\'{{district}}\'))));
$grid->setDefaultFilters(array(\'titulo\' => \'1\'));
$grid->setExport(array(// define parameters for csv export,see Bvb_Grid::getExports
\'csv\' => array(\'caption\' => \'Csv\'),\'pdf\' => array(\'caption\' => \'Pdf\')));
$grid->setJqgParams(array(\'caption\' => \'jqgrid Example\',\'forceFit\' => true,\'viewrecords\' => false,// show/hide record count right bottom in navigation bar
\'rowList\' => array(10,20,30,40,50),// show row number per page control in navigation bar
\'altRows\' => true)// rows will alternate color
);
$grid->setJqgParam(\'viewrecords\',true);
$grid->jqgViewrecords = true;
$grid->setBvbParams(array(\'id\' => \'ID\'));
$grid->setBvbParam(\'id\',\'ID\');
$grid->bvbId = \'ID\';
$grid->bvbOnInit = \'console.log(\"this message will not be logged because of call to bvbClearOnInit().\");\';
$grid->bvbClearOnInit();
$grid->bvbSetonInit(\'console.log(\"jqgrid initiated ! If data are remote they are not loaded at this point.\");\');
$grid->setAjax(get_class($grid));
}
解决方法
如果您对此没有任何了解,则可能需要查看jqgrid Wiki。它们提供有关添加内联单元格编辑的信息:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:cell_editing
以及弹出表单编辑:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing
根据内联单元格编辑页面,添加cellEdit参数应启用单元格编辑。您可以使用cellurl参数提供数据提交到的url。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。