zftable 模块 zend 框架 2 [英] zftable module zend framework 2

查看:25
本文介绍了zftable 模块 zend 框架 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 ZF2 相册教程并设置 zfTable 模块,可在此处使用:

I am trying to use the ZF2 Album tutorial and set up zfTable module, which is availible here:

https://github.com/dudapiotr/ZfTable

我已按照此站点上的安装说明进行操作,我觉得很好.然而,我确实觉得对于 Zendframework 2 的新手来说缺乏实现部分的细节.

I have followed the install instructions on this site, and I feel that is fine. I do however feel there is a lack of detail on the implementation part for someone new to zendframework 2.

谁能解释一下如何举一个基本的例子并将结果实现到表格中?我认为相册示例非常完美,因为很多人将其用作起点.

Could anyone explain how to take a basic example and implement the result into the table? I think the Album example is perfect as many people use this as a starting block.

http://dudapiotr.eu/table/base

在基本安装说明之后,此站点提供的唯一参考信息是类.

The only information this site gives in reference to get this working after the basic install instructions is a class.

关于把这个类放在哪里、如何调用它等的一些细节会很棒.

Some details of where to put this class, how to call it etc would be great.

我认为这对许多其他似乎有此问题的人来说很有用(但似乎没有解决方案或教程,呵呵)

I think this would be a great use to many others who seem to have this problem (but no solution or tutorial seems to be out there hehe)

class Base extends AbstractTable
{

    protected $config = array(
        'name' => 'Base table',
        'showPagination' => true,
        'showQuickSearch' => false,
        'showItemPerPage' => true,
        'itemCountPerPage' => 20,
        'showColumnFilters' => false,
        'showExportToCSV ' => false,
        'valuesOfItemPerPage' => array(5, 10, 20, 50 , 100 , 200),
        'rowAction' => ''
    );

    //Definition of headers
    protected $headers = array(
        'idcustomer' => array('title' => 'Id', 'width' => '50') ,
        'name' => array('title' => 'Name' ),
        'surname' => array('title' => 'Surname' ),
        'street' => array('title' => 'Street'),
        'city' => array('title' => 'City' ),
        'active' => array('title' => 'Active' , 'width' => 100 ),
    );

    public function init()
    {
    }

    protected function initFilters(\Zend\Db\Sql\Select $query)
    {

    }
}

谢谢,

推荐答案

经过很多辛苦和麻烦之后,我设法让这个工作正常进行.

I managed to get this working, after much toil and trouble.

我想对试图做同样事情的人说的话:

What I would say to people trying to do the same:

按照基本说明进行操作后,查看 \vendor\dudapiotr\zftable 文件夹.

After you follow the basic instructions, look in the \vendor\dudapiotr\zftable folder.

在这里您可以看到他如何让一切正常工作的设置.例如结构,

Here you can see the setup of how he got everything to work. For example the structure,

控制器示例 -> 模型、表格示例

Controller Example -> Model, TableExample

我用它来实现它到我自己的模块中.这当然需要您更改命名空间和模块名称等.

I used this to implement it into my own module. This ofcourse requires you to change namespaces and module names etc.

如果有人回复这个帖子,我会考虑制作一个指南,因为我花了 12 多个小时才完成,所以我相信其他人也会遇到同样的问题.

If people reply to this thread I will consider making a guide, as it took me over 12 hours to work out so I am sure others will have the same problems.

当它工作时,它很棒..继续尝试

When it is working, it is great.. keep trying

这篇关于zftable 模块 zend 框架 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆