Yii Framework Forum: Gridview Header - Showing Little Icon By Default - Yii Framework Forum

Jump to content

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

Gridview Header - Showing Little Icon By Default Rate Topic: -----

#1 User is offline   Fan_Of_Yii 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 105
  • Joined: 28-July 11

Posted 27 April 2013 - 03:59 AM

Hello All,

In Grid View by default my records are sorted on last name . But I am not finding a way to show the little ascending symbol next to my header by default . If I click on the header it starts showing up .Could any one tell me showing it by default the icon ? Below are the pictures and code . Thanks for your help - Yii Fan


Posted Image


$this->widget('zii.widgets.grid.CGridView', array(
        'dataProvider' => $people,
        'id' => "peopleList",
        'template' => "{items}{pager}",
        'columns' => array(
            array(
                'name' => 'last_name',
                'type' => 'raw',
                'header' => 'Last Name',
                'htmlOptions' => array('width' => '180'),
               
            ),

0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,601
  • Joined: 04-March 10
  • Location:UK

Posted 30 April 2013 - 04:27 AM

If you specify the default sort order when configuring your data provider, the symbol will show up automatically:

    $dataProvider->sort->defaultOrder = array('last_name'=>CSort::SORT_ASC);

1

#3 User is offline   Fan_Of_Yii 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 105
  • Joined: 28-July 11

Posted 01 May 2013 - 10:12 AM

View PostKeith, on 30 April 2013 - 04:27 AM, said:

If you specify the default sort order when configuring your data provider, the symbol will show up automatically:

    $dataProvider->sort->defaultOrder = array('last_name'=>CSort::SORT_ASC);



Thank You Keith . This helped me

Regards
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