Esempio n. 1
0
 /**
  * Construct the select
  *
  * @param string id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->dataSource = Kendo::createDataSource()->setSchema(['data' => 'results', 'total' => 'count'])->setServerFiltering(true)->setServerPaging(true);
     $this->widget = Kendo::createDropDownList('#' . $id)->setDataSource($this->dataSource)->setDataValueField('id')->setDataTextField('name');
     $this->addAttribute('name', $id);
 }
Esempio n. 2
0
 /**
  * Construct the table
  *
  * @param string id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->model = Kendo::createModel()->setId('id');
     $this->dataSource = Kendo::createDataSource()->setSchema(['model' => $this->model, 'data' => 'results', 'total' => 'count'])->setServerFiltering(true)->setServerSorting(true)->setServerPaging(true);
     $this->widget = Kendo::createGrid('#' . $this->_id)->setDataSource($this->dataSource)->setSortable(['allowUnsort' => false]);
 }
Esempio n. 3
0
    /**
     * Expand tree through provided path
     *
     * @param array path from highest node to the last
     * @return Riesenia\Utility\Kendo\Tree
     */
    public function expand($path = [])
    {
        $this->widget->setDataBound(Kendo::js('function (e) {
            var expand = $("#' . $this->_id . '").data("expand");

            // initial
            if (typeof expand === "undefined") {
                expand = ' . json_encode($path) . ';
            }

            if (expand.length) {
                var id = expand.shift();

                // select if last node or expand this node
                var node = this.findByUid(this.dataSource.get(id).uid);
                if (!expand.length) {
                    this.select(node);
                } else {
                    this.expand(node);
                }

                $("#' . $this->_id . '").data("expand", expand);
            }
        }'));
        return $this;
    }
Esempio n. 4
0
 /**
  * Construct the chart
  *
  * @param string id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->model = Kendo::createModel()->setId('id');
     $this->dataSource = Kendo::createDataSource()->setSchema(['model' => $this->model, 'data' => 'results', 'total' => 'count'])->setServerFiltering(true);
     $this->widget = Kendo::createChart('#' . $id)->setDataSource($this->dataSource);
 }
Esempio n. 5
0
 /**
  * Return JavaScript
  *
  * @return string
  */
 public function script()
 {
     $rangeCode = '';
     // range from
     if ($this->_rangeFrom) {
         $rangeCode = '$("#' . $this->_rangeFrom . '").data("' . $this->widget->name() . '").max(this.value() ? this.value() : this.max());';
     }
     // range from
     if ($this->_rangeTo) {
         $rangeCode = '$("#' . $this->_rangeTo . '").data("' . $this->widget->name() . '").min(this.value() ? this.value() : this.min());';
     }
     $this->widget->setChange(Kendo::js('function(e) {
         // date for hidden field
         var value = this.value();
         $("#' . $this->_id . '-hidden").val(value ? kendo.date.addDays(value, value.getTimezoneOffset() / -1440).toISOString().substring(' . $this->_substringStart . ', ' . $this->_substringEnd . ').replace("T", " ") : "");
         ' . $rangeCode . '
     }'));
     $script = $this->widget->__toString();
     $script .= 'setTimeout(function() {
         if ($("#' . $this->_id . '").length) {
             $("#' . $this->_id . '").data("' . $this->widget->name() . '").trigger("change");
         }
     }, 1);';
     return $script;
 }
Esempio n. 6
0
 /**
  * Construct the uploader
  *
  * @param string id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->widget = Kendo::createUpload('#' . $id);
     $this->addAttribute('name', $id);
 }
Esempio n. 7
0
 /**
  * Construct the tabber
  *
  * @param string id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->widget = Kendo::createTabStrip('#' . $id);
 }
Esempio n. 8
0
 /**
  * Construct the window
  *
  * @param string id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->widget = Kendo::createWindow('#' . $id)->setWidth(700)->setModal(true)->setResizable(false)->setVisible(false);
 }
Esempio n. 9
0
 /**
  * Construct the picker
  *
  * @param string id
  */
 public function __construct($id)
 {
     parent::__construct($id);
     $this->widget = Kendo::createDateTimePicker('#' . $id);
 }
Esempio n. 10
0
 /**
  * Set template providing only id
  *
  * @param string template id
  * @return Riesenia\Utility\Kendo\ListView
  */
 public function setTemplateById($id)
 {
     $this->widget->setTemplate(Kendo::js('kendo.template($("#' . $id . '").html())'));
     return $this;
 }