public function run()
    {
        TabularAsset::register($this->view);
        $table = '
<table class="footable table table-striped table-bordered">
  <thead>
    <tr>
      <th>Name</th>
      <th data-hide="phone">Phone</th>
      <th data-hide="phone,tablet">Email</th>
    </tr>
  </thead>
  <tbody>
    <tr>
        <td>
            Wendel Toews
        </td>
        <td>
            324237
        </td>
        <td>
            we@kdljf.kdjf
        </td>
    </tr>
  </tbody>
</table>';
        return $table;
    }
Beispiel #2
0
 public function run()
 {
     TabularAsset::register($this->view);
     //Get rid of pagination.
     $this->dataProvider->pagination->pageSize = 500000;
     //make sure we have a post model
     if (empty($this->postModel)) {
         throw new InvalidConfigException("You need a postModel for the TabularInput widget");
     }
     if ($this->fooTableOptions) {
         $this->tableOptions['class'] .= ' footable';
         /**
          * :TODO: Footables does not work with 2 header rows. So the filter is disabled if we use footables
          */
         $this->filterPosition = false;
         foreach ($this->fooTableOptions['columns'] as $column => $device) {
             if (!empty($this->columns[$column - 1])) {
                 $this->columns[$column - 1]->headerOptions['data']['hide'] = $device;
             } else {
                 Yii::error('You have assigned Foo Table options to non-existent columns');
             }
         }
         $this->registerFooScript();
     }
     //if there are fewer rows that our $minRows then add some empty models
     if ($this->dataProvider->totalCount < $this->minRows) {
         $nRowsToAdd = $this->minRows - $this->dataProvider->totalCount;
         for ($x = 1; $x <= $nRowsToAdd; $x++) {
             $className = $this->filterModel->className();
             $newModel = new $className();
             $newModels[] = $newModel;
         }
         $this->dataProvider->setModels($newModels);
     }
     if ($this->footerAddButton) {
         $this->showFooter = true;
         if (empty($this->footerAddButton['options'])) {
             $this->footerAddButton['options'] = ['class' => 'btn btn-primary', 'id' => $this->id . '-addbutton-footer'];
             //StringHelper::basename($this->postModel->className()).'-tabular-addbutton'];
         }
         $this->footerButtonContent = Html::button($this->footerAddButton['label'], $this->footerAddButton['options']);
     }
     $this->tableRowMarkup = $this->renderTableRow($this->postModel, 'key', '1');
     Yii::info($this->tableRowMarkup);
     parent::run();
 }