ListJs.php
public function run()
	{
		$content = ob_get_clean();
		$search = '';
		$sort = [];
	
		$view = $this->getView();
		
		ListJsAsset::register($view);
		
		$js = "var yii2lj" . ucfirst(strtolower(str_replace('-', '', $this->clientOptions['id']))) . " = new List('" . $this->clientOptions['id'] . "', " . json_encode($this->clientOptions) . ");";
		$view->registerJs($js, $view::POS_READY);
		
		if(empty($content)) {
			if(empty($this->content)) {
				$content = $this->content;
			} elseif($this->view != null && is_string($this->view)) {
				$content = $view->render($this->view, $this->viewParams);
			}
		}
		
		if($this->search) {
			$search = Html::tag('input', '', array_merge([
				'class' => 'form-control search', 
				'placeholder' => 'Search',
			], $this->searchOptions));
		}
		
		if(!empty($this->sort)) {
			foreach($this->sort as $key => $field) {
				if(is_string($field) && in_array($field, $this->clientOptions['valueNames'])) {
					$sort[] = Html::button($field, ['class' => 'btn btn-default sort', 'data-sort' => $field]);
				} elseif(is_array($field) && in_array($key, $this->clientOptions['valueNames'])) {
					$label = isset($field['label']) ? $field['label'] : $key;
					$sort[] = Html::button($label, array_merge([
						'class' => 'btn btn-default sort',
						'data-sort' => $key,
					], $field));
				}
			}
		}
		
		$html = str_replace(['{search}', '{sort}', '{content}'], [$search, implode(' ', $sort), $content], $this->layout);
		
		echo Html::tag('div', $html, $this->options);
	}
public function run()
	{
		$content = ob_get_clean();
		$search = '';
		$sort = [];
	
		$view = $this->getView();
		
		ListJsAsset::register($view);
		
		$js = "var yii2lj" . ucfirst(strtolower(str_replace('-', '', $this->clientOptions['id']))) . " = new List('" . $this->clientOptions['id'] . "', " . json_encode($this->clientOptions) . ");";
		$view->registerJs($js, $view::POS_READY);
		
		if(empty($content)) {
			if(empty($this->content)) {
				$content = $this->content;
			} elseif($this->view != null && is_string($this->view)) {
				$content = $view->render($this->view, $this->viewParams);
			}
		}
		
		if($this->search) {
			$search = Html::tag('input', '', array_merge([
				'class' => 'form-control search', 
				'placeholder' => 'Search',
			], $this->searchOptions));
		}
		
		if(!empty($this->sort)) {
			foreach($this->sort as $key => $field) {
				if(is_string($field) && in_array($field, $this->clientOptions['valueNames'])) {
					$sort[] = Html::button($field, ['class' => 'btn btn-default sort', 'data-sort' => $field]);
				} elseif(is_array($field) && in_array($key, $this->clientOptions['valueNames'])) {
					$label = isset($field['label']) ? $field['label'] : $key;
					$sort[] = Html::button($label, array_merge([
						'class' => 'btn btn-default sort',
						'data-sort' => $key,
					], $field));
				}
			}
		}
		
		$html = str_replace(['{search}', '{sort}', '{content}'], [$search, implode(' ', $sort), $content], $this->layout);
		
		echo Html::tag('div', $html, $this->options);
	}
Runs the widget.