Yii Framework Forum: Somehow I can't change the column size in CGridView - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Somehow I can't change the column size in CGridView Rate Topic: -----

#21 User is offline   Chris Backhouse 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 04-August 11
  • Location:France

Posted 28 October 2011 - 03:30 AM

If you specify a custom filter on each column, you can include the size of the input box.

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'properties-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
        'columns'=>array(
		'ref',
		array(
                    'name'=>'type1',
                    'filter'=> CHtml::textField('type1',$model->type1,array('size'=>10)),
                    ),
	 ............

0

#22 User is offline   marcovtwout 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 16-September 10
  • Location:Delft, NL

Posted 20 January 2012 - 03:45 AM

At least use headerHtmlOptions when setting column specific settings, you don't need to set the width for each and every td.
Yii-Environment Extension - Predefine configurations for use in different environments, like development, testing, staging and production.
NetBeans IDE and Yii projects - Short directions and general tips for managing a Yii application in NetBeans IDE
0

#23 User is offline   urgent 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 20-July 11

Posted 26 January 2012 - 11:41 PM

This really is more of a html problem than a CGridView problem. What you need is the table-layout:fixed; rule in your table tag, and overflow with a with rule in your td tag.

http://stackoverflow.com/questions/1057574/html-td-wrap-text
0

#24 User is offline   zeesniper 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 08-January 13

Posted 11 January 2013 - 01:06 AM

Neither of these worked for me...

At least solved by adding max-wdith to css in assets\ff2aa0ca\gridview\style.css

grid-view table.items th, .grid-view table.items td
{
	font-size: 0.9em;
	border: 1px white solid;
	padding: 0.3em;

	max-width: 115px;
}

Attached File(s)


0

#25 User is offline   Jimako 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 23-January 12
  • Location:Slovak Republic

Posted 29 January 2013 - 02:29 PM

View Postwsmits, on 29 April 2011 - 07:48 AM, said:

...
I need to figure out how to add a class to each individual filter textbox to let this resizing work.

Excuse my English.

I had the same problem. Using htmlOptions in grid helped only for columns without filter field.
I tried in my styles.css:
.grid-view table.items tr.filters td 
{
  width: 50px;
}

And it helped.
- I use bootstrap.widgets.TbGridView
- no width in 'htmlOptions' in Grid
- and 50px is minimum width of columns, real width depends propably on lenght of data. If I want more px, then I use width in 'htmlOptions'.
'htmlOptions'=>array('style'=>'width:100px;'),

0

#26 User is offline   rajesh chaurasia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 12-January 13
  • Location:Mohali

Posted 15 June 2013 - 05:26 AM

hi friend if i write a comment like
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

than how to set it in grid column in a width is there is any option just to ignore wordwrap.?
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

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