我想在Yii 2中更改GridView的顯示格式。例如,我希望有一些行和列的數據,如Internet市場顯示產品。 例如,在每一行中我想要有4-5個產品.. 這是默認使用GridView的一個示例。如何在yii2中更改Gridview格式?
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'sim_num',
'network',
'twog_network',
'threeg_network',
// 'fourg_network',
// 'bady_struct',
// 'process',
// 'other:ntext',
// 'os',
// 'gesture',
// 'items',
// 'speaker',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
如何像HTML表格的格式顯示從數據庫中的數據,並確定在它分頁行數和列數?
謝謝;)
是否可以在列表視圖中添加過濾器進行搜索? – areff
您正在使用數據提供程序進行篩選,所以是的,就像在GridView中一樣。不同之處在於過濾器表單不像GridView那樣與數據表相結合,您必須將其添加到ListView旁邊。 – Bizley
謝謝:)讓我測試它 – areff