dudapiotr / ZfTable

*Not supported*ZfTable 3.1. Awesome ZF2 table / grid (and much much more) generator with huge possibilities of decorating and conditioning. Integrated with DataTables, Doctrine 2, Bootstrap 2.0 and 3.0.
http://dudapiotrek.laohost.net/
MIT License
75 stars 59 forks source link

Conflict with the module SlmLocale #57

Closed yannickvid closed 9 years ago

yannickvid commented 9 years ago

When using Zftable and SlmLocale (https://github.com/juriansluiman/SlmLocale) with the strategy "uripath", the table is displayed properly but it is not possible to use the filters. It looks like the Ajax request always return the whole table.

The module SlmLocale is used to detect the locale of a project. The UriPath strategy add the locale at the beginning of the URL. Ex: "myproject.com/page1" will become "myproject.com/en/page1". When I deactivate the UriPath strategy, Zftable is working properly.

Has anyone tried to work with both these modules at the same time?

yannickvid commented 9 years ago

This may not be the best way to do it, but at least it solves the issue:

Instead of doing the requests by calling: $("#tableContainer").zfTable('/admin/members/ajax-list');

You need to call the full URL with the locale: $("#tableContainer").zfTable('<?php echo "http://" . $_SERVER['SERVER_NAME']; ?>/en/admin/members/ajax-list');

yannickvid commented 9 years ago

As suggested by juriansluiman on his module page, it will be better to use ZF2 View Helpers like so:

$("#tableContainer").zfTable('<?php echo $this->url('admin-members', array('action' => 'ajax-list'), array('force_canonical' => true))?>');

Please note that you need the "array('force_canonical' => true)" to display the full URL, otherwise it will not work.