Link to home
Start Free TrialLog in
Avatar of Peos John
Peos JohnFlag for Malaysia

asked on

PHP Flexigrid with Code Igniter return to the same page number after edit

I have a list in Flexigrid and the edit form in a different page. Problem is after edit process is completed I would like to return the same page number from which row is edited. Instead it always goes to the first page of the list.

All of the this done in Codeigniter., after searching for a while I got below solution but still I am not sure how to get to the history page from the edit is clicked.

$('#MyFlex') .flexOptions({ url: urlAction, newp: 1 }).flexReload();

Open in new window

Avatar of Peos John
Peos John
Flag of Malaysia image

ASKER

I use redirect method to redirect the list page

/**
     * This method handles to update a product details
     * */
    public function update($id) {
		
		
        $this->template->title($this->lang->line('title_product_manager_update'));
        $data = [];
        $images = [];
        $rows = $this->product_model->get_product_by_id($id);
 
                $data['category_id'] = $this->input->post('category_id');
                $data['sub_category_id'] = $this->input->post('sub_category_id');
                $data['retail_price'] = $this->input->post('retail_price');
                $data['wholesale_price'] = $this->input->post('wholesale_price');
                $data['larimar'] = $this->input->post('larimar');
                $data['saleprice'] = $this->input->post('saleprice');
                $data['style_no'] = $this->input->post('style_no');
                $data['width'] = $this->input->post('width');
                $data['height'] = $this->input->post('height');
                $data['chain_length'] = $this->input->post('chain_length');
				$data['dimensions'] = $this->input->post('dimensions');
                $data['gender']         = $this->input->post('gender');
 
                 $result = $this->product_model->update_product_by_id($id, $data);
 						 
                 redirect($this->lang->line('url_product_manager'));
                }
            }
        }
        if ($rows) {

            $rows = $rows[0];
            $data['id'] = $rows->id;
            $data['name'] = $rows->name;
            $data['collection_id'] = $rows->collection_id;
            $data['description'] = $rows->description;
            $data['accent_stone_id'] = $rows->accent_stone_id;
            $data['category_id'] = $rows->category_id;
            $data['sub_category_id'] = $rows->sub_category_id;
            $data['retail_price'] = $rows->retail_price;
            $data['wholesale_price'] = $rows->wholesale_price;
            $data['saleprice'] = $rows->saleprice;
            $data['style_no'] = $rows->style_no;
            $data['width'] = $rows->width;
            $data['height'] = $rows->height;
            $data['gender'] = $rows->gender;
			 
			$collection_image_result = $this->product_model->get_product_collection_image_by_id($rows->id);
			$data["collection_image"] = $collection_image_result[0];

            $seo_data = $this->product_model->get_product_seo($rows->id);
            $data["seo_keywords"] = $seo_data["seo_keywords"];
            $data["seo_description"] = $seo_data["seo_description"];
        }
         $this->template->build('product_manager/update', $data);
    }

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.