Answer the question
In order to leave comments, you need to log in
Sampling from a DB of all fields except the first?
I'm pulling data from the database and displaying it in a table. In the table that is currently displayed 3 rows, How to display all rows except the first.
Output Code
<?php Pjax::begin(); ?>
<?= GridView::widget([
'filterUrl' => Url::toRoute('index'),
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
[
'attribute'=>'company_types__alias',
'label'=> $Package->t('', 'Тип'),
'format'=>'text',
'content'=>function($data){
if ($data->type != null)
return $data->type->title;
},
'filter' => CompanyTypes::getList()
],
'alias',
'name',
'email',
'phone',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} '
],
],
]); ?>
<?php Pjax::end(); ?>
Answer the question
In order to leave comments, you need to log in
Good afternoon.
As an option - list the fields that need to be displayed
ps Also pay attention to the limit and offset
In yii1 there was a property that counts iterations, you can use it visible=> (count != 1).
You can try to set a property to an object and do it through the same visible=> ($data->visible). Return false on first call and then true.
Or make a selection without the first value, and then form a dataProvider (active, array). For example, LIMIT in mysql can have two parameters [offset,] rows]. Perhaps the same LIMIT can be fed to the provider (there is no way to check now)
Perhaps (there is no way to check now) after creating the dataProvider, you can unset the extra value.
Or, if you can find out the id of the entry which should not be, then through the same visible.
Although, I am a supporter that initially the superfluous does not hit the target.
Well, or in the most extreme case, use JS, although this is just a poison pill in the collar, but as here and now, temporarily, it will do.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question