Ublaboo datagrid + Nextras ORM radenie väzieb

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
Čamo
Člen | 798
+
0
-

Zdravím,
chcem sa spýtať či niekto nevie poradiť s radením v Ublaboo + Nextras ORM.
Mám entitu $medicalPlanDoctor ktorá má väzbu M:1 na $medicalPlan a tá má väzbu 1:M $tasks
$medicalPlanDoctor->medicalPlan->tasks
Tretí parameter v addColumn by mal byť stĺpec. Ale čokoľvek tam napíšem skončí to chybou. Neexistuje niečo ako ->setCondition() aj pre setSortable? Kód vyzerá takto.

$grid->addColumnDateTime('lastVisit', "entity.medicalPlanDoctor.lastVisit")
	->setRenderer( function ($item) use ($cDomain) {
		$task = $item->medicalPlan->tasks->get()->getBy(['this->doctor->id' => $item->doctor->id]);
		return $task && $task->closed
			? $task->closed->format('d.m.Y')
			: '<span class="label label-danger">' . $this->translator->translate("$cDomain.noVisit") . '</span>';
		})
	->setTemplateEscaping( FALSE )
	->setSortable()
	->setFilterDateRange()
		->setCondition(function ($fluent, $value) {
			if( isset($value['from']) && isset($value['to']) )
			{
				$fluent->getQueryBuilder()
					->from('medical_plans_x_doctors', 'medical_plans_x_doctors')
					->innerJoin('medical_plans_x_doctors', 'medical_plans', 'medical_plans', 'medical_plans_x_doctors.medical_plan_id = medical_plans.id')
					->innerJoin('medical_plans', 'tasks', 'tasks', 'tasks.medical_plan_id = medical_plans.id AND medical_plans_x_doctors.doctor_id = tasks.doctor_id')
					->andWhere('tasks.date_to_resolve > %dt', DateTime::createFromFormat('j. n. Y', $value['from']))
					->andWhere('tasks.date_to_resolve_end < %dt', DateTime::createFromFormat('j. n. Y', $value['to']))
					->andWhere('tasks.closed IS NOT NULL')
					->addOrderBy('tasks.date_to_resolve_end DESC')
					->addGroupBy('medical_plans_x_doctors.doctor_id');
			}
		});
Čamo
Člen | 798
+
+2
-

Takže odpoveď je setSortableCallback()