Yii Framework Forum: CListView tagName=table and table header - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CListView tagName=table and table header how to? Rate Topic: ***** 1 Votes

#1 User is offline   barbq 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 25-September 10

Posted 03 March 2011 - 04:22 PM

Hi,

I have choose CListView class for displaying rows. It works really nice, but I have just realized that I don't know how to add table header because I set itemsTagName to 'table' so it generates table...
Is it possible at all?

Ray

p.sPlease do not advice switching to CGridView :)
0

#2 User is offline   jkofsky 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 536
  • Joined: 17-May 10
  • Location:Pensacola, Florida

Posted 03 March 2011 - 05:32 PM

View Postbarbq, on 03 March 2011 - 04:22 PM, said:

Hi,

I have choose CListView class for displaying rows. It works really nice, but I have just realized that I don't know how to add table header because I set itemsTagName to 'table' so it generates table...
Is it possible at all?

Ray

p.sPlease do not advice switching to CGridView :)

I'm a bit confused by what you are trying to achieve. The model has a function to get the field labels, and one for getting the Table name().

In all of the examples that I have seen on the CListView, none have a "Header". They do have a field label.

Maybe a quick example of what you are trying to create would help us help you :)
Do, or do not. There is no 'try.' Jedi Master Yoda
1

#3 User is online   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,346
  • Joined: 12-October 09
  • Location:Croatia

Posted 04 March 2011 - 02:19 AM

CListView does not have a method for rendering the header...

for every item... CLIstView renders the file in itemView and among other values it sends the current index of the item (zero based index)

so one solution would be... in the view to check if the index is zero... and then display the headers before the current item (first record)...
Find more about me.... btw. Do you know your WAN IP?
2

#4 User is offline   barbq 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 25-September 10

Posted 04 March 2011 - 11:47 AM

View Postmdomba, on 04 March 2011 - 02:19 AM, said:

CListView does not have a method for rendering the header...

for every item... CLIstView renders the file in itemView and among other values it sends the current index of the item (zero based index)

so one solution would be... in the view to check if the index is zero... and then display the headers before the current item (first record)...


So damn easy... Thank you!!! :)
0

#5 User is offline   barbq 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 25-September 10

Posted 04 March 2011 - 11:48 AM

View Postjkofsky, on 03 March 2011 - 05:32 PM, said:

I'm a bit confused by what you are trying to achieve. The model has a function to get the field labels, and one for getting the Table name().

In all of the examples that I have seen on the CListView, none have a "Header". They do have a field label.

Maybe a quick example of what you are trying to create would help us help you :)


mdomba solved already the problem, but thanks for your try! :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users