Welcome Guest, Not a member yet? Register   Sign In
Multiple datagrid display into one view page

[eluser]Jilani Jidni[/eluser]

I wanna add multiple datagrid into same view page. I have done this but the column order by is not working. please view my code

$this->load->model('Merchant_model', 'Merchant_model', TRUE);
    $data['packageList'] = $this->Merchant_model->getMerchantPackages($merchant_row_id);
    $data['paymentHistory'] = $this->Merchant_model->getPaymentHistory($merchant_row_id);
    $this->load->view('administration/merchantDetails', $data);

function getMerchantPackages($merchant_row_id)
        $sql = 'SELECT
                pack.package_id, pack.package_name, m.subscription_type,m.subscription_date,m.completion_date,m.active_status
                FROM tbl_merchant_package_history m, tbl_package pack
                WHERE m.merchant_row_id = '.$merchant_row_id.' and pack.package_id = m.package_id';

        $sql = '(' . $sql . ' ) AS abc';
        $getInstance = & get_instance ();
        $getInstance->load->library ( 'rapyd' );
                $this->rapyd->load ( 'datagrid' );
                $grid = new DataGrid ( '', $sql );
        $grid->order_by ( 'subscription_date', 'DESC' );
        $grid->per_page = 10;
        $grid->column_orderby ( 'Package', 'package_name', 'package_name', 'align=\'center\'' );
        $grid->column ( 'Subscription Type', 'subscription_type', 'subscription_type', 'align=\'center\'' );
        $grid->column_orderby ( 'Subscription Date', 'subscription_date', 'subscription_date', 'align=\'center\'' );
        $grid->column ( 'Package completion date', 'completion_date', 'completion_date', 'align=\'center\'' );
        $grid->column ( 'Active Status', 'active_status', 'active_status', 'align=\'center\'' );
        $grid->build ();
        return $grid->output;
    function getPaymentHistory($merchant_row_id)
        $sql = '(SELECT ack, payment_id,error_text,date_of_transaction    
                    FROM tbl_payment_details
                    WHERE pd.merchant_row_id =' . $merchant_row_id .')as abc';

        $getInstance = & get_instance();

        $grid = new DataGrid('', $sql);
        $grid->per_page = 10;
        $grid->order_by ( 'payment_id', 'DESC' );
        $grid->column_orderby ('Charge Date', 'date_of_transaction', 'date_of_transaction', 'align=\'center\'');
        $grid->column ('Payment Status', 'ack', 'align=\'center\'');
        $grid->column ('Error', 'error_text', 'align=\'center\'');
        return $grid->output;

<tr><td>Package List</td></tr>
  <tr><td>Payment History</td></tr>

when I am clicked on order by link then its shows a database error. This error occurred because every time it called the same controller function.

please help me on this issue.

Hi Jilani,
you should specify you're using the Rapyd libary, as not everyone may recognise it.
Well, I don't think that's the problem, but the syntax you are using is different from what I usually do.
You write:
$grid->column_orderby ('Charge Date', 'date_of_transaction', 'date_of_transaction', 'align=\'center\'');

so you're passing four params. I usually write something like
$grid->column_orderby ('Label Name', '<#value#>', 'field_name', 'style=\'css style\'');

In particular, the field value stays between '<# ... #>'
Maybe I'm just missing something...


[eluser]Jilani Jidni[/eluser]
Hi andrea

Thanks for your reply. Sorry I forgot to write this that I used Rapyd Library .

I think may I have not clear my problem to you all. Trying to clear it once again.....

when I wanna sort the datagrid by column wise then a database error occur unknown column name "filed_name" .

Because two datagrids are build from two tables of data. when I want to sort one datagrid this also called the second one and the problem arise that time.

Theme © iAndrew 2016 - Forum software by © MyBB