tdphong Posted October 14, 2015 Report Posted October 14, 2015 Hi all, I'm using ajax to pagination for my plugin. But when i use it, it's not working. Please view my code as image below and feedback for me. Thanks,
Tyson Posted October 14, 2015 Report Posted October 14, 2015 Your pagination URI doesn't look correct. Query parameters must come at the end of the URI. 'uri' => $this->base_uri . "settings/company/plugins/manage/" . $this->plugin_id . "/[p]/?feed_id=12345",
tdphong Posted October 15, 2015 Author Report Posted October 15, 2015 Thanks Tyson, I done that! URL is correct but when i click on pagination, it's not load page, in here ajax is not work. I must refresh page that it work. Can you help me about this? You can see images below. Thanks, http://uphinhnhanh.com/view-4893058_4.png http://uphinhnhanh.com/view-6513771_5.png http://uphinhnhanh.com/view-4631710_6.png
Blesta Addons Posted October 15, 2015 Report Posted October 15, 2015 Thanks Tyson, I done that! URL is correct but when i click on pagination, it's not load page, in here ajax is not work. I must refresh page that it work. Can you help me about this? You can see images below. Thanks, http://uphinhnhanh.com/view-4893058_4.png http://uphinhnhanh.com/view-6513771_5.png http://uphinhnhanh.com/view-4631710_6.png can you paste the code you have in your function ? it will be easy for us to find the cause . yo have firebug installed in firefox ? is yes , when you click in the pagination is the request send ? and what is the output ?
tdphong Posted October 16, 2015 Author Report Posted October 16, 2015 Hi naja7host, Here is my code : class AdminManagePlugin extends AppController { /** * Performs necessary initialization */ private function init() { // Require login $this->parent->requireLogin(); Language::loadLang("myGateway_manage_plugin", null, PLUGINDIR . "myGateway" . DS . "language" . DS); $this->uses(array("myGateway.myGatewayOrder", "Transactions", "Services", "Packages")); // Use the parent data helper, it's already configured properly $this->Date = $this->parent->Date; $this->plugin_id = isset($this->get[0]) ? $this->get[0] : null; // Set the page title $this->parent->structure->set("page_title", Language::_("myGatewayManagePlugin." . Loader::fromCamelCase($this->action ? $this->action : "index") . ".page_title", true)); return $this->renderAjaxWidgetIfAsync(isset($this->get['sort']) ? true : (isset($this->get[1]) || isset($this->get[0]) ? false : null)); } /** * Returns the view to be rendered when managing this plugin */ public function index() { $this->init(); $status = (isset($this->get['status']) ? $this->get['status'] : "pending"); $page = (isset($this->get[1]) ? (int) $this->get[1] : 1); $sort = (isset($this->get['sort']) ? $this->get['sort'] : "date_added"); $order_sort = (isset($this->get['order']) ? $this->get['order'] : "desc"); //print_r($status);exit; if (isset($this->get[0])) $status = $this->get[0]; // If no page set, fetch counts if (!isset($this->get[1])) { $status_count = array( 'pending' => $this->myGatewayOrder->getListCount("pending"), 'accepted' => $this->myGatewayOrder->getListCount("accepted"), 'fraud' => $this->myGatewayOrder->getListCount("fraud"), 'canceled' => $this->myGatewayOrder->getListCount("canceled"), ); } $statuses = $this->myGatewayOrder->getStatuses(); unset($statuses[$status]); $order = array(); $total_results = $this->myGatewayOrder->getListCount(null); $order['order'] = $this->myGatewayOrder->getList(null, $page, array($sort => $order_sort)); $feeds = $this->myGatewayOrder->getDefaultFeeds(Configure::get("Blesta.company_id")); // Overwrite default pagination settings $settings = array_merge(Configure::get("Blesta.pagination"), array( 'total_results' => $total_results, 'uri' => $this->base_uri . "settings/company/plugins/manage/" . $this->plugin_id . "/[p]/", 'params' => array('sort' => $sort, 'order' => $order_sort), ) ); //$this->uses(array("Transactions", "Services", "Packages")); // print_r($this->Transactions->getApplied(null, $order['order'][0]->id));exit; $vars = array( 'feeds' => $feeds, 'plugin_id' => $this->plugin_id, 'status_count' => $status_count, 'orders' => $order['order'], //'transaction_types' => $this->Transactions->transactionTypeNames() ); $this->helpers(array("Pagination" => array($this->get, $settings))); $this->Pagination->setSettings(Configure::get("Blesta.pagination_ajax")); // Set the view to render for all actions under this controller $this->view->setView(null, "myGateway.default"); return $this->partial("admin_manage_plugin", $vars); } } Please help me! Thanks,
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now