With Alpha-2 release onward, there's a Javscript UI helper file called GrammarIntelliForJsUIHelper.js. This library helps you to bind a GIMachine to a text box, taking away the pain to define your list view for suggestions.
Once attached, this library takes care of showing suggestions, has Up/Down/Enter key support. Though the color/styling customization is still WIP.

You can try out a demo at here

Using GIUIHelper is very simple, once you are ready with your GIMachine definition & you know which text box to use (where user types the query)... just add two lines (onload of page or anywhere your code structure demands):

            // First, make sure you have included the GrammarIntelliForJsUIHelper.js script file
            // --------------------------------------------------------------------------------------------
            var oInputControl = document.getElementById("txtUserInput");  // This is the text box where user types
            var oUIHelper = new GIUIHelper(oInputControl, oGIMachine);        // You should have your oGIMachine object ready by now
            oUIHelper.Initialize();                                                             // Remember to call  UIHelper's Initialize method

Here's a snap of a usage of GIUIHelper, you can also try it at here


Last edited Jan 23, 2011 at 5:55 PM by rb_adhikari, version 5


No comments yet.