/sc_query_autocomplete

Primary LanguageJavaScriptMIT LicenseMIT

SC Query Autocomplete

An autocompletion framework to complement the SproutCore datastore framework.

  • QAC.ScqlGuesser: The root controller. Text goes in, a stack of query tokens and a list of next-up guesses comes out. Used by QAC.QueryFieldView; you can also implement your own view by consuming the currentText, tokenStack and guesses properties. When you need to snag the query's full text out, get the fullText property.
  • QAC.AttributeGuesser: Suggests attribute autocompletions, including for related records. Used by the ScqlGuesser class when the user is entering an attribute.
  • QAC.QueryFieldView: A view which manages the text entry, token display and autocompletions generated by QAC.ScqlGuesser.

Includes an extension to SC.Record to facilitate class-level attribute introspection.

Basic Example

MyApp.QueryView = QAC.QueryFieldView.extend({ controller: QAC.ScqlGuesser.extend({ recordType: MyApp.MyRecordType }) });