Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:22:17+00:00 2026-06-01T09:22:17+00:00

I have view page with both detailview and gridview the grid view should be

  • 0

I have view page with both detailview and gridview
the grid view should be automatically filltered by detailview datas.one important thing is detail view model and gridview model are not same they should taken from different models and i didnt assign any relation so all needs to be manul.
and also the view should be exported to pdf and excel view.

my view.php is

   <?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
    'id',
    'invoice_no',
    'invoice_date',
    'dc_no',
    'dc_date',
    'client',
    'total_amount',
    'status',
),
)); ?>

   <?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'invoice-transaction-grid',
'dataProvider'=>$dataProvider->search(),
'filter'=>$model,
'columns'=>array(
    //'invoice_id',
//'invoice_no',
    'dc_no',
    'client',
   /*array(
    'name'=>'client',
        'value'=>'Client::model()->findByPk($data->client)->Client_name',

   'filter'=>CHtml::listData(Client::model()->findall(),'Client_id','Client_name'),
    ),*/
    'project',
     /*array(
        'name'  => 'project',
        'value' => 'Project::model()->findByPk($data->project)->proj_name',
   'filter'=>CHtml::listData(Project::model()->findall(),'proj_id','proj_name'),
        ),*/
    'complexity',
  /*array(
        'name'  => 'complexity',
        'value' => 'Complexity::model()->findByPk($data->complexity)->Complexity_Name',

   'filter'=>CHtml::listData(Complexity::model()->findall(),'id','Complexity_Name'),
        ),*/
    'totalpage',
    'rate_per_page',
    'total_amount',

    /*array(
        'class'=>'CButtonColumn',
    ),*/
),
     )); ?>

i need to display the grid automatically filtered by the detailed view data (‘invoice_no’,)
my controller for the above view

public function actionView($id)
{
 //$dataProvider=new CActiveDataProvider('InvoiceTransaction');


    $dataProvider=new InvoiceTransaction('search');//this is a different model
    $dataProvider->unsetAttributes();  // clear any default values
    if(isset($_GET['InvoiceTransaction']))
        $dataProvider->attributes=$_GET['InvoiceTransaction'];
    $this->render('view',array(
        'model'=>$this->loadModel($id),'dataProvider'=>$dataProvider,
    ));
}

how to solve my problem..anyone can give suggest

ANSWER hi i got answer for filtering questioni just added default filter value in my controller

public function actionView($id)
{
 //$dataProvider=new CActiveDataProvider('InvoiceTransaction');
     $model=$this->loadModel($id);

    $dataProvider=new InvoiceTransaction('search');
    $dataProvider->unsetAttributes();  // clear any default values
    if(isset($_GET['InvoiceTransaction']))
        $dataProvider->attributes=$_GET['InvoiceTransaction'];
        $dataProvider->invoice_no=$model->invoice_no;/// this line only gave me answer

 //$model->unsetAttributes(); 
      if(isset($_GET['InvoiceMaster']))
        $dataProvider->attributes=$_GET['InvoiceMaster'];
    $this->render('view',array(
        'model'=>$model,'dataProvider'=>$dataProvider,
    ));
}

but now struggling to export this both detailview and gridview on same file to pdf or excel.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:22:20+00:00Added an answer on June 1, 2026 at 9:22 am

    PHPExcel can create Excel documents and export them to PDF. Some examples can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a product view page that contains an MVCContrib HTML Grid with
I have implemented horizontal page view. One base page and three swipe pages. The
If you have several view models on one page, how do you ensure that
I have a view page that accepts a taxonomy term id as an argument
I have a view page in Yii. It is cached with page cache. Now,
I have a controller's action and view page that uses a master page. The
Im create this code to store page view in database, but i have problem
I'm using Spree 0.70. In my home page view, I have the following to
I have a drop-down list hardcoded in an MVC View User Control page and
I have a view that I am using for articles on the front page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.