title: ArrayDataProvider gridview yii2
body: <p>I have this </p>
  
  <pre><code> public function actionIndex()
  {
      $data = order::getSome();
      $dataProvider = new ArrayDataProvider([
          'allModels' =&gt; $data,
          'sort' =&gt; [
              'attributes' =&gt; ['paid']
          ]
  
  
      ]);
      return $this-&gt;render('index',['dataProvider' =&gt;$dataProvider]);
  }
  </code></pre>
  
  <p>If in gridview delete <code>'columns'=&gt; [</code>, there is post all columns in data correct. If in <code>'columns'=&gt; [</code> put names of columns, there is '0' in all columns. How to display specific columns?</p>
  
  <pre><code>`public static function getSome(){
       return   Yii::$app-&gt;getDb()-&gt;createCommand(
              "SELECT order_customFields.order_customFields_delivery_method,
  
      sum(case `order`.order_status when 'paid' then 1 else 0 end) paid,
      sum(case `order`.order_status when 'later' then 1 else 0 end) later,
    sum(case `order`.order_status when 'delivery-approved' then 1 else 0 end) deliveryapproved,
  
  FROM order_customFields 
    INNER JOIN `order` ON order_customFields.order_id = `order`.order_id
  WHERE
    order_customFields.order_customFields_order_date &gt;= '2016-12-01' AND
    order_customFields.order_customFields_order_date &lt;= '2016-12-31' 
  AND order_customFields.order_customFields_delivery_method is not null
  GROUP BY    
     order_customFields.order_customFields_delivery_method"
          )-&gt;queryAll();
      }`
  </code></pre>