Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    cannot access databound pciklist editor in listgrid

    Version:
    SmartClient Version: SC_SNAPSHOT-2011-01-06/PowerEdition Deployment (built 2011-01-06) / GWT 1.7.1

    JS error:
    Uncaught JavaScript exception [com.google.gwt.core.client.JavaScriptException: (TypeError): Object doesn't support this property or method
    Uncaught JavaScript exception [com.google.gwt.core.client.JavaScriptException: (TypeError): Object doesn't support this property or method
    number: -2146827850
    number: -2146827850
    description: Object doesn't support this property or method
    description: Object doesn't support this property or method
    at com.smartgwt.client.widgets.form.fields.ComboBoxItem.fetchData(Native Method)
    at com.smartgwt.client.widgets.form.fields.ComboBoxItem.fetchData(Native Method)
    at com.ourcompanyname.appname.client.ui.pre.PortfolioGrid$4.onChanged(PortfolioGrid.java:164)
    at com.smartgwt.client.widgets.form.fields.events.ChangedEvent.dispatch(ChangedEvent.java:97)
    at com.smartgwt.client.widgets.form.fields.events.ChangedEvent.dispatch(ChangedEvent.java:1)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
    at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:237)] in http://localhost:8084/...[company name cut out]...Main, line 8

    Question:
    I have a databound ComboBoxItem which, as a the user types each letter, fires a 'changed' event which I catch. Now in that event handler i do a myComboItem.fetchData() to refetch the possible autocomplete options from the server for the given typed in characters. In the case, when in the onChanged handler I see that there is a record selected from the combo options table, I just replace the current typed in value with the appropriate autocomplete and do some other fun stuff as well.

    This works wonderfully on its own as a remote smart autocomplete that uses some fuzzy logic to look up options on the server as the user is typing each letter, kinda like google does it for search.

    When I try using this for in-place editing in a grid using setEditorType, there is a problem. I cannot call myComboItem.fetchData to get the possible autocomplete values, because there is no way to access the combo item. The only methods available are setEditedValue. But I need to call fetchData on it, not just set the value. When I try to call fetchData directly on my original combo item I set editor type to I get the above JS error.

    I think this is because when I am accessing the combo item to which I set the editor type, I am just accessing the prototype, not the actual instance SC creates on the fly to edit a record in a grid.

    The big question is how do I access the actual edited combo item so that I can refetch the available options from the server based on the current typed in values in a 'changed' handler, or carry out some other custom action. I need access to the editor. How do I do that?

    #2
    You need to switch approaches - the ComboBoxItem already has a bunch of logic to fetch data and has a lot of lifecycle management around data fetches. Fetching at an arbitrary time will result in duplicate fetches and mess all of this up.

    Instead, just provide a PickListFilterCriteriaFunction and return whatever criteria you need to be sent to the server.

    Comment

    Working...
    X