title: How to get previous and next row model ID in yii2 gridview data row
body: <p>While in GridView widget and displaying ActiveDataprovider results that i fetched from a customized query, i want to get next and previous row $model->id while displaying the records, what i need to do is to show links to previous and next posts while in reading mode, my gridview already generates link to the post view but there doesnt seem to be an option to get next DB row's record ID</p>
  
  <p>i have already tried to use default values in the function available but they dont seem to hold any related data</p>
  
  <pre><code>GridView::widget([
      'dataProvider' =&gt; $dataProvider,
      ...
      'columns' =&gt; [
          ...
          [
             'label'=&gt;'Post Name',
             'format' =&gt; 'raw',
             'value'=&gt;function ($data, $key, $index, $obj) {
                  // this is what i have right now
                  return Html::a($data-&gt;name, ['view', 'id' =&gt; $data-&gt;id]);
  
                  //ideally i would like something like this
                  return Html::a($data-&gt;name, ['view', 
                       'id' =&gt; $data-&gt;id,
                       'prev' =&gt; $prev-&gt;id,
                       'next' =&gt; $next-&gt;id
                  ]);
              },
          ],
      ],
      ....
  )];
  </code></pre>