Results 1 to 6 of 6

Thread: Using Architect How can you pass a value to a data store for searching from a field

  1. #1

    Default Using Architect How can you pass a value to a data store for searching from a field

    I have a form field in my app, and I want to pass the contents of the form field to a data-store.

    The data-store populates a dropdown/combo box.

    I understand how to do most things but this is one area I am lacking knowledge.

    I would have a 'go' button next to the text field so they would type in the search term and press go... or i would use onchange to do it on the fly... either way, how do i pass the text field into the url field of the store?

    Thanks

  2. #2
    Sencha Premium User
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,255
    Answers
    27

    Default

    you mean like this?

    under: 'Example usage:' click on 'Live Preview' button...
    http://localhost/extjs421/docs/index...field.ComboBox

  3. #3

    Default

    That link refers to http://localhost... Do you have a link on the sencha.com website instead?

  4. #4
    Sencha User
    Join Date
    May 2011
    Location
    Melbourne, Australia
    Posts
    89
    Answers
    5

    Default

    Architect instructions:
    • select textfield to get value from.
    • Config Panel -> "Event Bindings" else drag a "Basic Event binding" from the Toolbox onto textfield
    • enter "change" as the event
    • right click this binding and select "convert to action" and choose the controller for that view
    This Controller Action will have the textfield parameters set.
    The code:

    Code:
    // query - clear any spaces from search string
    var query  = Ext.String.trim(query),
        //findRecord( fieldName, value, [startIndex], [anyMatch], [caseSensitive], [exactMatch] )
        record = Ext.getStore('NameOfStore').findRecord(textfield.getName(), query, 0, false, true, true);
    
    
    if (Ext.isDefined(record)) {
        Ext.Viewport.down('targetSelectfield').setRecord(record);
    }
    This is very general code using alternatives where exact field names are not known.
    textfield.getName() would more than likely by "url" if that is the field you wish to look up in store. Replace "textfield.getName()" with the name of the field in the store (string), and set the textfield's name variable to the same.

    Also, one would reference the output field directly, else restrain the targeting selection to within a panel / container.

  5. #5

    Default

    Hi Greg,
    Thank you for the assisstance. I'm very eager to get this working.

    OK so I am stuck at the part where you say enter "change" as the event. I'm not sure where to do that.
    When I examine the properties of the Basic Event binding, it says it requires a function and name. I'm not sure where I would put the change action. Or do I need to drag a change action on that?

  6. #6
    Sencha User
    Join Date
    May 2011
    Location
    Melbourne, Australia
    Posts
    89
    Answers
    5

    Default

    Event Binding: name

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •