Forums: How to filter data on first load - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to filter data on first load

#1 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16042
  • Joined: 03-February 03

Posted 06 January 2016 - 10:32 PM

Q: I'd like to filter my data initially only showing customers where status is 'active'. This should not affect all subsequent searches.

A: There are several ways to achieve that. Probably the easiest way is to add the following to 'After table initialized' event of the table in question:

if (System.Web.HttpContext.Current.Request.QueryString.Count==0)
query.addWhere("status='active'");

Best regards,
Sergey Kornilov
0

#2 User is offline   ChrisN 

  • Member
  • PipPip
  • Group: Members
  • Posts: 26
  • Joined: 01-November 14

Posted 01 February 2016 - 10:53 AM

Thanks to jadach for pointing out this post :)


Seems to do the job. However, there also seems to be a catch ... if I then sort by clicking the column header, the filter is lost. i.e. all data are returned, not just the filtered records.


Is there a way to keep the filter in place after rendering the initial data?

Thanks in advance.



PS At the risk of stretching this post too far, I would like the user to be able to set the date range, rather than making this a design time parameter selection. Should I start a new topic?
0

#3 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16042
  • Joined: 03-February 03

Posted 02 February 2016 - 08:27 PM

This subforum is not for questions really. Feel free to start a new topic in the main forum.
Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic