⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


Member Since 22 Jun 2012
Offline Last Active Jan 28 2019 12:33 PM

#148981 Issue whith export and print buttons

Posted rdroguett on 25 January 2019 - 02:59 PM

The data is lost, when your press the  print or export button. I dont have any solutions when i send in get or post method.

#148979 Issue whith export and print buttons

Posted rdroguett on 25 January 2019 - 02:54 PM

I have a some problem. The post data lost when i press export or print action

#16519 grocery crud master-detail 1_n relation implementation

Posted rdroguett on 11 September 2018 - 05:47 PM

Nice code... buts in my model i have a trouble... but i never recive the parameters into de callback...





CREATE TABLE `e_order` (
  `ide_order` int(11) NOT NULL,
  `run` varchar(11) NOT NULL,
  `date` datetime NOT NULL
CREATE TABLE `e_product` (
  `ide_product` int(11) NOT NULL,
  `code` varchar(45) NOT NULL,
  `name` varchar(45) NOT NULL,
  `price` int(11) NOT NULL,
  `ide_order` int(11) NOT NULL



    public function genera_orden(){
        $customer   = new SoapClient("http://www.appoctava.cl/ws/WebService.php?wsdl", $this->data['conexion']);
        foreach($this->token_model->validar_token() as $row)
            $array  = array("TOKEN" => $row->token); 
                $result         = $customer->__SoapCall("validartokenext", $array); 
                $result_code    = $result[0]->DescripcionResultado; 
                if($result_code == 'TVAL'){
                    $crud = new grocery_CRUD();
                    $crud->set_subject('Orden de Compra');
                    $crud->fields('run', 'date', 'product');
                    $crud->callback_add_field('product', array($this, 'list_product'));

                    $crud->callback_before_insert(array($this, 'save_product'));
                    $crud->callback_before_update(array($this, 'save_product'));

                    $output = $crud->render();
                    echo "ERROR TOKEN";
            }catch(SoapFault $e){ 
                echo "Ups!! hubo un problema y no pudimos recuperar los datos.<br/>$e<hr/>"; 

function save_product($post_array, $primary_key){        
$this->db->delete('e_product', array('ide_order' => $primary_key));
        $i = 0;
        $data = array();
        while(!empty($post_array["product_code"][$i]) ){
            $product = array(
                'code'      => $post_array["product_code"][$i],
                'name'      => $post_array["product_name"][$i],
                'price'     => $post_array["product_price"][$i],
                'ide_order' => $primary_key
            array_push($data, $product);
        $this->db->insert_batch('e_product', $data);
function list_product($value = '', $primary_key = null){        
$this->db->where('ide_order', $primary_key);
        $products = $this->db->get('e_product')->result_array();
        $products[1] = array();
        $html = '
            <table id="product_list"> 
                    <th>CODIGO</th><th>NOMBRE ARTICULO</th><th>PRECIO ($CLP)</th>
                foreach ($products as $product){
                $html.= '<tr>'. 
                        '<td><input name="product_code[]" type="text" value="'.$product["code"].'"></td>'. 
                        '<td><input name="product_name[]" type="text" value="'.$product["name"].'"></td>'. 
                        '<td><input name="product_price[]" type="text" value="'.$product["price"].'"></td>'. 
                        '<td><button class="remove_number btn btn-danger">Eliminar</button></td></tr>';
                $html .='<tr>'.
                        '<td><input name="product_code[]" type="text"></td>'.
                        '<td><input name="product_name[]" type="text"></td>'.
                        '<td><input name="product_price[]" type="text"></td>'.
                        '<td><button id="remove_number" class="remove_number btn btn-danger">Eliminar</button></td></tr></table>'.
                        '<button type="button" id="add_number" class="cancel-button ui-input-button ui-button ui-widget ui-state-default ui-corner-all ui-state-hover" style="width: 100px; margin:20px 0px;">Agregar</button>';
                return $html;