Chumper\Datatable\Table::setOptions PHP Method

setOptions() public method

Set a single option or an array of options for the jquery call
public setOptions ( )
    public function setOptions()
    {
        if (func_num_args() == 2) {
            $this->options[func_get_arg(0)] = func_get_arg(1);
        } else {
            if (func_num_args() == 1 && is_array(func_get_arg(0))) {
                foreach (func_get_arg(0) as $key => $option) {
                    $this->options[$key] = $option;
                }
            } else {
                throw new Exception('Invalid number of options provided for the method "setOptions"');
            }
        }
        return $this;
    }

Usage Example

 /**
  * @expectedException Exception
  */
 public function testSetOptions()
 {
     $this->table->setOptions('foo', 'bar');
     $this->table->setOptions(array('foo2' => 'bar2', 'foo3' => 'bar3'));
     $this->table->setOptions('foo', 'bar', 'baz');
 }