public function testRenderTable() { $table = new Table(new \Illuminate\Pagination\Paginator([['test' => "mytest"]])); $table->setTableWrapper('{table}'); $table->addColumn('test'); $output = $table->render(); $this->assertTag(array('tag' => 'table', 'id' => 'ResultTable', 'attributes' => array('class' => 'table table-bordered table-striped'), 'child' => array('tag' => 'thead', 'descendant' => array('tag' => 'tr', 'descendant' => array('tag' => 'th', 'child' => array('tag' => 'a', 'attributes' => array('href' => '/?sort=test&sort_dir=asc&page=0', 'class' => 'grid-view-sort-asc'), 'content' => 'Test'))))), $output); $this->assertTag(array('tag' => 'table', 'id' => 'ResultTable', 'attributes' => array('class' => 'table table-bordered table-striped'), 'child' => array('tag' => 'tbody', 'descendant' => array('tag' => 'tr', 'descendant' => array('tag' => 'td', 'content' => 'mytest')))), $output); }
/** * @return mixed|string */ public function getFilter() { $value = array_get($this->table->getInput(), $this->name); // if the value coming back from array_get is an array, it means name is not set. we don't want an array. if (is_array($value)) { $value = ''; } if (isset($this->filter) && is_array($this->filter)) { return sprintf('<select name="%s" class="form-control">%s</select>', $this->name, $this->buildDropDownList($this->filter, $value)); } if (!isset($this->filter)) { return sprintf('<div class="grid-view-filter-container"> <input type="text" name="%s" style="width:100%%" class="grid-view-filter input-small form-control" value="%s"> </div>', $this->name, e($value)); } return $this->filter; }