<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-cn">
		<id>http://wiki.tomtalk.net/index.php?action=history&amp;feed=atom&amp;title=Yii%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5</id>
		<title>Yii代码片段 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.tomtalk.net/index.php?action=history&amp;feed=atom&amp;title=Yii%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5"/>
		<link rel="alternate" type="text/html" href="http://wiki.tomtalk.net/index.php?title=Yii%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5&amp;action=history"/>
		<updated>2026-04-24T09:51:32Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>http://wiki.tomtalk.net/index.php?title=Yii%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5&amp;diff=4064&amp;oldid=prev</id>
		<title>Tom：/* yii的gridview使用 */</title>
		<link rel="alternate" type="text/html" href="http://wiki.tomtalk.net/index.php?title=Yii%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5&amp;diff=4064&amp;oldid=prev"/>
				<updated>2014-11-24T09:43:11Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;yii的gridview使用&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==yii的gridview使用==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$this-&amp;gt;widget('zii.widgets.grid.CGridView', array(&lt;br /&gt;
    'id' =&amp;gt; 'xx-xx-grid',&lt;br /&gt;
    'dataProvider' =&amp;gt; $model-&amp;gt;search(),&lt;br /&gt;
    'filter' =&amp;gt; $model,&lt;br /&gt;
    'pager' =&amp;gt; array(&lt;br /&gt;
        'class' =&amp;gt; 'CLinkPager',&lt;br /&gt;
        'nextPageLabel' =&amp;gt; '下一页',&lt;br /&gt;
        'prevPageLabel' =&amp;gt; '上一页',&lt;br /&gt;
        'header' =&amp;gt; '',&lt;br /&gt;
    ),&lt;br /&gt;
    'summaryText' =&amp;gt; '&amp;lt;font color=#0066A4&amp;gt;显示{start}-{end}条.共{count}条记录,当前第{page}页&amp;lt;/font&amp;gt;',&lt;br /&gt;
    'columns' =&amp;gt; array(&lt;br /&gt;
        array(&lt;br /&gt;
            'name' =&amp;gt; 'id',&lt;br /&gt;
            'htmlOptions' =&amp;gt; array('width' =&amp;gt; '25'),&lt;br /&gt;
            'sortable' =&amp;gt; false,&lt;br /&gt;
        ),&lt;br /&gt;
        array(&lt;br /&gt;
            'class' =&amp;gt; 'CButtonColumn',&lt;br /&gt;
            'template' =&amp;gt; '{view} {update}',&lt;br /&gt;
            'viewButtonOptions' =&amp;gt; array('title' =&amp;gt; '查看'),&lt;br /&gt;
            'updateButtonOptions' =&amp;gt; array('title' =&amp;gt; '修改'),&lt;br /&gt;
        ),&lt;br /&gt;
        array(&lt;br /&gt;
            'class' =&amp;gt; 'CButtonColumn',&lt;br /&gt;
            'header' =&amp;gt; '首页展示',&lt;br /&gt;
            'template' =&amp;gt; '{add} {del}',&lt;br /&gt;
            'buttons' =&amp;gt; array(&lt;br /&gt;
                'add' =&amp;gt; array(&lt;br /&gt;
                    'label' =&amp;gt; '展示', // text label of the button&lt;br /&gt;
                    'url' =&amp;gt; 'Yii::app()-&amp;gt;controller-&amp;gt;createUrl(&amp;quot;focus/create&amp;quot;,array(&amp;quot;id&amp;quot;=&amp;gt;$data-&amp;gt;primaryKey,&amp;quot;type&amp;quot;=&amp;gt;1))', // a PHP expression for generating the URL of the button&lt;br /&gt;
                    'imageUrl' =&amp;gt; 'http://s.maylou.com/common/images/ysh.jpg', // image URL of the button. If not set or false, a text link is used&lt;br /&gt;
                    'options' =&amp;gt; array('style' =&amp;gt; 'cursor:pointer;'), // HTML options for the button tag&lt;br /&gt;
                    'click' =&amp;gt; $click, // a JS function to be invoked when the button is clicked&lt;br /&gt;
                    'visible' =&amp;gt; 'SiteRecommend::isItemInTypeAndId(1, $data-&amp;gt;id)?false:true',&lt;br /&gt;
                ),&lt;br /&gt;
                'del' =&amp;gt; array(&lt;br /&gt;
                    'label' =&amp;gt; '取消展示', // text label of the button&lt;br /&gt;
                    'url' =&amp;gt; 'Yii::app()-&amp;gt;controller-&amp;gt;createUrl(&amp;quot;focus/delete&amp;quot;,array(&amp;quot;id&amp;quot;=&amp;gt;$data-&amp;gt;primaryKey,&amp;quot;type&amp;quot;=&amp;gt;1))', // a PHP expression for generating the URL of the button&lt;br /&gt;
                    'imageUrl' =&amp;gt; 'http://s.maylou.com/common/images/yzhu.jpg', // image URL of the button. If not set or false, a text link is used&lt;br /&gt;
                    'options' =&amp;gt; array('style' =&amp;gt; 'cursor:pointer;'), // HTML options for the button tag&lt;br /&gt;
                    'click' =&amp;gt; $click, // a JS function to be invoked when the button is clicked&lt;br /&gt;
                    'visible' =&amp;gt; 'SiteRecommend::isItemInTypeAndId(1, $data-&amp;gt;id)?true:false',&lt;br /&gt;
                )&lt;br /&gt;
            ),&lt;br /&gt;
        ),&lt;br /&gt;
    ),&lt;br /&gt;
));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tom</name></author>	</entry>

	</feed>