locked
Paging a list of records, or setting a default filter in the HTML client? RRS feed

  • Question

  • I'm using a details modal picker in conjunction with a text box to run a query and filter the resulting list of items.  The query has an optional parameter, linked to the text box, and if nothing is entered then all records are returned.

    However, this list could get pretty long, and I would like to somehow page it rather than risk 2,000 items showing up and crashing the browser?  I know I'm not the first person to ask about this and any tips or links would be appreciated. 

    If that's too much trouble, is it possible to provide a default filter on my query, or somehow limit to a top 100?

    If it helps, my filter strategy is based on Beth Massi's excellent article here-- https://blogs.msdn.microsoft.com/bethmassi/2013/08/29/how-to-use-a-picker-as-a-filter-in-your-lightswitch-apps/

    Thursday, March 17, 2016 4:13 PM

All replies

  • You can set a default value for the parameter in your query.

    In the _postRender method of the parameter binding control to set a default value for this control. Then it can do a default query search for the details model picker.

    Friday, March 18, 2016 7:30 AM
  • Thanks very much.  That would certainly help, providing a default value in the parameter field on the page.

    However, a user could clear out that value and the query would pull back everything.  My ideal situation is to limit the query itself to a top X number of rows returned, regardless of the parameter.

    Friday, March 18, 2016 8:59 PM