title: Yii: Format of dataProvider in CGridView
body: <p>What is the array format to display the data in <strong>CGridView</strong>.</p>
  
  <p>I'm sending the array to <strong>dataProvider</strong> but nothing is comming in browser.</p>
  
  <p>I'm using below code in my models </p>
  
  <pre><code> public function ExtensionList()
          {
                          // I'm Using 2 database So I'm calling db2-&gt;createCommand
                          $row = Yii::app()-&gt;db2-&gt;createCommand(array(
                          'select' =&gt; array('extension', 'date_created'),
                          'from' =&gt; 'extensions',
                          'where' =&gt; "extension_type = 'EXTENSION'",
                          ))-&gt;queryAll();
  
                          return $row ;
  
                 }
  </code></pre>
  
  <p>my Index.php </p>
  
  <pre><code>&lt;?php $this-&gt;widget('zii.widgets.grid.CGridView', array(
        'id'=&gt;'extension-grid',
        'dataProvider'=&gt;$model-&gt;ExtensionList(),
        'columns'=&gt;array(
                'extension',
                'date_created',
        ),
  )); ?&gt;
  </code></pre>
  
  <p>What is the wrong in the below format of array.</p>
  
  <blockquote>
    <p>Array ( [0] => Array ( [extension] => 2000 [date_created] =>
    2013-07-24 21:15:09.993303 ) [1] => Array ( [extension] => 2001
    [date_created] => 2013-07-24 21:23:07.94538 ) [2] => Array (
    [extension] => 2002  [date_created] => 2013-07-26 11:58:59.537204 ) )</p>
  </blockquote>
  
  <hr>
  
  <p>If I used below code, grid is displaying in my another model</p>
  
  <pre><code>  $criteria=new CDbCriteria;
                          $criteria-&gt;select='service_id,count(*) as counts';
                          $criteria-&gt;condition = "sdate between '$this-&gt;startdate' and '$this-&gt;enddate'";
                          $criteria-&gt;group ='service_id';
  
                     return new CActiveDataProvider($this, array(
                          'criteria'=&gt;$criteria,
                          'pagination' =&gt; array( 'pageSize' =&gt; 30 ),
                  ));
  </code></pre>
  
  <p>I'm using this type to execute query, its  working fine and records are displaying in grid.  </p>
  
  <p>But to display the extension list I'm using createCommand, its not working.</p>
  
  <pre><code> $row = Yii::app()-&gt;dbcc-&gt;createCommand(array(
                          'select' =&gt; array('extension', 'extension_type', 'date_created'),
                          'from' =&gt; 'accounts',
                          'where' =&gt; "extension_type = 'EXTENSION'",
                          ))-&gt;queryAll();
  return new CActiveDataProvider($this, array(
                         'criteria'=&gt; $row ,
                           ));
  </code></pre>
  
  <p>Note: I'm using Yii 1.1.13</p>