locked
Type Ahead List Search with LightSwitch HTML Client RRS feed

  • Question

  • Just getting started with the HTML Client in LightSwitch.

    I'm wanting to implement a search pop-up where the user narrows the list of items as they type into a text box above the list.  I found a great example by Heinrich Wendel here,  but it requires the user to press enter or tab out of the input box to get the query to refresh and change the list.

    I've figured out how to intercept the key input event with something like the following:

    myapp.AddEditMetaModel.paramEntiyTypeSearch_postRender = function (element, contentItem) {
        element.addEventListener('input', function (e) {
            element.focus();
        });
    };
    In this case, calling element.focus() causes the input to lose focus and the list to update. However, it seems that calling element.focus() again does not place the focus back to the input.  The result is that the first keystroke updates the list.  Unfortunately, the user has to manually move focus back to the input before entering another letter...worse than having to hit the enter key.

    I've also tried raising numerous other events that might cause the query to re-execute, to no avail.

    The cleanest thing to do, I believe, would be to refresh the entitySet/Query like you're able to do in Silverlight LightSwitch with the EntitySet.ResetBindings(false) call.  Does anyone know how to accomplish this with the HTML Client, or any other possible solutions that would proved a type-ahead search list?

    Thanks in advance for any suggestions.

    Dave



    • Edited by DaveVanB Friday, June 28, 2013 6:20 PM
    Friday, June 28, 2013 6:17 PM

All replies