Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I access the data filters in this MVC3 VB application BEFORE loading the data?
    primarykey
    data
    text
    <p>I have a few filters for table data represented by dropdowns, but the table data is really huge and the process hangs for a few minutes until the complete table is rendered; only then is the table presented and I can use those filters. </p> <p>I want to be able to access the filters before presenting the data; I don't want to wait for the table to load. This could be done by separating the filters into another view/controller, but I want to handle inside the <code>index()</code> method. </p> <p>I tried to delete the part where the process checks if filters are set, but then than it will work if I set all filters only.</p> <p>Relevant code:</p> <pre><code>Function Index(SelectedTimeType As System.Nullable(Of Integer), SelectedTimeStatus As System.Nullable(Of Integer), SelectedProject As System.Nullable(Of Integer), SelectedTask As System.Nullable(Of Integer)) As ActionResult Dim tipovi = unitOfWork.TimeTypeRepository.Get(orderBy:=Function(q) q.OrderBy(Function(d) d.Opis)) ViewBag.SelectedTimeType = New SelectList(tipovi, "TimeTypeID", "Opis", SelectedTimeType) Dim statusi = unitOfWork.TimeStatusRepository.Get(orderBy:=Function(q) q.OrderBy(Function(d) d.Opis)) ViewBag.SelectedTimeStatus = New SelectList(statusi, "TimeStatusID", "Opis", SelectedTimeStatus) Dim projekti = unitOfWork.ProjectRepository.Get(orderBy:=Function(q) q.OrderBy(Function(d) d.Opis)) ViewBag.SelectedProject = New SelectList(projekti, "ProjekatID", "Opis", SelectedProject) Dim taskovi = unitOfWork.TaskRepository.Get(orderBy:=Function(q) q.OrderBy(Function(d) d.Opis)) ViewBag.SelectedTask = New SelectList(taskovi, "TaskID", "Opis", SelectedTask) Dim timeTypeID As Integer = SelectedTimeType.GetValueOrDefault() Dim timeStatusID As Integer = SelectedTimeStatus.GetValueOrDefault() Dim projekatID As Integer = SelectedProject.GetValueOrDefault() Dim taskID As Integer = SelectedTask.GetValueOrDefault() Return View(unitOfWork.TimeTrackingRepository.Get( filter:=Function(d) Not (SelectedTimeType.HasValue And SelectedTimeStatus.HasValue And SelectedProject.HasValue And SelectedTask.HasValue) OrElse (d.TimeTypeID = timeTypeID And d.TimeStatusID = timeStatusID And d.ProjectID = projekatID And d.TaskID = taskID), orderBy:=Function(q) q.OrderBy(Function(d) d.TimeTrackingID))) End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload