public function getData($applyPaging = TRUE, $useCache = TRUE, $fetch = TRUE)
{
if ($this->getModel() === NULL) {
throw new Exception('Model cannot be empty, please use method $grid->setModel().');
}
$data = $this->data;
if ($data === NULL || $useCache === FALSE) {
$this->applyFiltering();
$this->applySorting();
if ($applyPaging) {
$this->applyPaging();
}
if ($fetch === FALSE) {
return $this->getModel();
}
$data = $this->getModel()->getData();
if ($useCache === TRUE) {
$this->data = $data;
}
if ($applyPaging && !empty($data) && !in_array($this->page, range(1, $this->getPaginator()->pageCount))) {
$this->__triggerUserNotice("Page is out of range.");
$this->page = 1;
}
if (!empty($this->onFetchData)) {
$this->onFetchData($this);
}
}
return $data;
}