CList View

Any thought to display CListview ‘summery’ at top .

Then header row for data.

Then actual Data Items.

Thnks

It’s not very clear what you mean…

CListView has a summary text on top… check the template property

you cannot display headers… as it uses a custom view file for display, so the data can be displayed in any way possible, not only in columns…

To display data in columns with a header and summary you can use CGridView…

See attached file

what i want 'sort by ’ option before red header

Then header

Then Items Listings

I want to use view file to render listings thats why i am using CListView instead of Grid

Thnks

Because you have not specified if you need a sort button out of the CListView or on it i paste you the following…

Check the CListView documentation … i quote some things for you.

In the documenation there is an example which contains this…




    'sortableAttributes'=>array(

        'title',

        'create_time'=>'Post Time',

    ),



@tydeas_dr

i put image for better view.However i am sorry i could not explain my point batter.

I want sorting and summery out of the CListView.

Mean summery and sorting First

Then Heading

Then Listings

Then Paging

Thnks

Problem is that CListView does not have a method for rendering headers, I presume you render the headers with a custom method or even directly in a view…

One solution would be to extend the CListView class… in your extended CListView class you need only to make one method renderHeader() and in the call to the custom CListView change the template from


"{summary}\n{sorter}\n{items}\n{pager}";

to


"{summary}\n{sorter}\n{header}\n{items}\n{pager}";

Note that the "sort by" line that you want to put before the headers is not the summary but the sorter.

@mdomba

Thnks for the solution…

After reading class reference and check code i did same as you told me in your last post

Yii is GREAT

yes first i was rendering header in view file directly but i was not satisfied that solution.

Now all is fine and i have extended my class from CListView and add my header code there

This is great stuff. I am new to Yii. I have this working well but have a couple of questions

  1. Where should the CMyListView class live?

/modules/MyListView/MyListView.php??

  1. Can you point me in the right direction if i want to add a ajax filter to my header?

Thanks