locked
Common Inventory Filter in LS HTML RRS feed

  • Question

  • Hello,

    I have been digging through the net and honestly, I feel like this should be pretty simple and native to LS, but I am not figuring this things out.

    When you browse a car dealerships website, you generally have a series of 'pickers', one on top of the other, for basic filtering of their inventory. For instance you can choose from a drop-down:

    Make (picker): Ford

    Model (picker): Fiesta

    Year (picker): 1999

    And it will show your results from their inventory.

    I have a requirement to do the same in LS HTML, but with technology assets. I need to use 'pickers' (which I do not even see as a control option in LS 2013) to choose things like...

    Building (picker): Central Middle School

    Device Type (picker): Laptop

    Model (picker): X1 Carbon

    This filter would show me all of the X1 Carbons in a particular school. Ideally that result will also show which room, lab, collection they are assigned to, etc. It would need to be more of a List view than the Tiles view, in order to show all the details for the filtered selection.

    Can this be achieved in LS HTML? It should be pretty basic functionality, but I do not even see the picker control with which to get started on queries.

    Thank you so much for any advice!

    Friday, January 8, 2016 4:15 PM

Answers

All replies

  • Hi CreedCor,

    According to your description, you want to implement a cascade picker in your LightSwitch HTML application, is it right?

    We need to create a ChangeListener method in Javascript and then after a picker choice a item, another picker which based on it will list the corresponding items. Detailed code, please refer to following thread, which is similar your problem. Hope that can help you.

    https://social.msdn.microsoft.com/Forums/en-US/aa045754-71d1-4068-bbbb-b30df15c2f5d/html-client-preview-2-cascade-pickers-issue

    Best Regards,
    Weiwei

    • Proposed as answer by Angie Xu Tuesday, January 26, 2016 7:18 AM
    • Marked as answer by Angie Xu Tuesday, January 26, 2016 7:18 AM
    Monday, January 11, 2016 4:31 AM
    Moderator
  • Yes, I want to use cascading pickers, but is it possible to use them to filter Browse results on the fly?

    For instance, have a Browse screen with a list view, will cascading pickers on the Screen.

    Unfiltered, there are no results, as the parameters are not optional.

    Then, using a picker, I select Building 'A'. Now the Browse Screen shows all Devices for Building 'A'.

    Going a step further, I select an item in the next picker, Collection 'A'.

    Now, the Browse Screen is showing all Devices in Building 'A' that belong to Collection 'A'.

    These items are now narrowed down and can be selected for edit, etc.

    So, I think I am looking for something a little different? Basically ad-hoc filtering of a Browse List.

    Thank you so much!!

    Monday, January 11, 2016 4:21 PM
  • Hi CreedCor,

    I think it is the same principle of your requirement and the referenced link. Please refer to another blog which introduce cascading picker with multiple tables in desktop application, but it also applicable to HTML application.

    http://blogs.msdn.com/b/bethmassi/archive/2012/01/12/creating-cascading-drop-down-lists-in-visual-studio-lightswitch.aspx

    Best Regards,
    Weiwei

    Tuesday, January 12, 2016 1:18 AM
    Moderator
  • Hello Weiwei!!

    I have been looking into this solution - and I think the best answer for me is to do this but... in reverse.

    Meaning, instead of hausing cascading pickers, I would rather start at the end and have the other columns auto-populate depending on the 'condition' of a chosen value.

    For instance, instead of choosing Dealer > Type > Make > Model, I would just select a Model, and the Make, Type, and Dealer be chosen and show in those fields automatically, as they would unique to that Model value. Does that make sense?

    Would that be best handled with Lightswitch somehow, or is that more an SQL thing?

    Thank you!!!


    • Edited by CreedCor Wednesday, January 13, 2016 2:13 PM
    Wednesday, January 13, 2016 2:12 PM
  • Hi CreedCor,

    The theory of reverse cascading pickers is the same with the sample project in my previous reply.

    In that blog, it create a query to City which based on the State and a query which sorted by the Name. These two query let us choose City based on the State. If you want to choose the State based on the City, please change these queries with following order.

    1. Create a query with City named SortedCity, which is ordered by the City Name.
    2. Create a query with State named StateByCity, which is based on the City.
    3. Set the City's Choices property with the SortedCity query.
    4. Set the State's Choices property with the StateByCity query.

    Best Regards,
    Weiwei

    Thursday, January 14, 2016 6:13 AM
    Moderator