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 7780539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:55:50+00:00 2026-06-01T18:55:50+00:00

how to show a gridview like the grid in GRIDVIEW WITH ROW EXPAND AND

  • 0

how to show a gridview like the grid in GRIDVIEW WITH ROW EXPAND AND COLLAPSEthe grid should show normal datas in view when clicking the row that should show the details of a thecorresponding row ..please help inthis…
my output should be like

MY GRID SHOULD BE LIKE THIS

AND when i click the row it should expand and give details(the image will show table but thats need not i need to render the detail view in that.
enter image description here

EDITED i forgot to add onething the grid will load from one model and row details will load from another model.

<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'books-grid',
'dataProvider'=>$model->Projectwisereport(),
//'filter'=>$model,

'columns'=>array(

    array(
        'name'  => 'Project',
        'value' => 'Project::model()->findByPk($data->Project)->proj_name',
   'filter'=>CHtml::listData(Project::model()->findall(),'proj_id','proj_name'),
        ),

    'isbn_no',
    'source_type',
array(
        'name'  => 'complexity',
        'value' => 'Complexity::model()->findByPk($data->complexity)->Complexity_Name',
                                                      'filter'=>CHtml::listData(Complexity::model()->findall(),'id','Complexity_Name'),
       'footer'=>'Total Page',
        ),
      array('class'=>'CButtonColumn',
     'template'=>'{detail}',
     'buttons'=>array(
      'detail'=>array(
            'label'=>'Show Details', 
                    'url'  =>'Yii::app()->createUrl("Process/View",   array("id"=>$data->book_id))',
                    'options'=>array('title'=>'Show details','class'=>'detailsLink'),
  'click'=>"$('#your-grid-book_id').on('click','.detailsLink',function(){
     var row=$(this).closest('tr');
      var url=$(this).attr('href');
   $.get(url,{},function(data){
  row.after(data.row);
     },'json');
     })",

            )
    ) 
)

),
    )); ?>  

i trided this but no use grid is from books model and link to process model in the CButton column

  • 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-01T18:55:51+00:00Added an answer on June 1, 2026 at 6:55 pm

    Try this:

    In GridView:

    'columns'=>array
         (
                'ID',
                array
                (
                      'name'=>'...',
                      'htmlOptions'=>array('class'=>'plus','id'=>$data->id),
                      'value'=>'...',
                ),
                ...
         ),
    

    js code:

    $(".plus").click(function(){
    var data = $(this).attr('id');
    var url = ...ajax url...
    jQuery.ajax({
                    'type':'post',
                    'data':data,
                    'url':url,
                    'cache':false,
                    'success':function(html){
                                                    var new_data = $("<div></div>").attr("class", "appended_data").html(html).attr("id",data);
                                                    $(this).parent().append(new_data);
                                                    $(this).removeClass('plus');
                                                    $(this).addClass('minus');
                                            }
            }); 
    });
    

    From your controller ajax action send data in trs(table rows)..I hope the code is self explainatory..

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

Sidebar

Related Questions

i want to style the grid view like i have to show 4 orders
How to show in the WPF Listview using the GridView an empty text (like
How to read the excel file and show its data in grid view ?
I want to show icon that associated with file type. Something like this But
I have a SQLite database that is displayed in a data grid view in
I would like to implement a grid view of pixmaps. This is how I
i am having a concept like i want to use grid view inside another
Have a gridview control which will show X amount of rows. I want to
is there some way to force the gridview's pager to show up, even when
In my activity i have to show some images. I used gridview in my

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.