Announcement

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

    Getting data from client side only datasource

    Hi, I have a client side only datasource that I use as the datasource for a comboboxitem. But I would like to use this as
    general lookup data in other parts of the code. How can I access specific data in the datasource - for example in this
    sample datasource how can I get the 'desc' value corresponding to a particular id?

    Code:
    <List>
        <skill>
            <id>1</id>
            <desc>Accountant</desc>
        </skill>
        <skill>
            <id>2</id>
            <desc>Accounting</desc>
        </skill>
    </List>

    #2
    Hi bc,

    did you try using yourDS.fetch(yourCriteria)? This should work for all types of DataSource.

    Best regards
    Blama

    Comment


      #3
      Thanks Blama. That works. I don't see a "fetch" call. I did a "fetchData" and was able to get
      the record inside the callback. Is this the only way or is there a way to get it synchronously?
      Thanks again.

      Comment


        #4
        Hi bc,

        yes, I meant fetchData. As components can't tell if a DataSource is clientonly or not I don't think it is possible to get clientonly data this way synchronously.
        But depending on the way you supply the data to SmartGWT you might be able to access them via standard java methods as well, which would be synchronously then.

        Best regards
        Blama

        Comment


          #5
          If you actually have a client side array of data described by a dataSource and you want to apply a filter to it in realtime, there is dataSource.applyFilter() - but yes - all standard DataBinding methods are asynchronous in order to allow consistent APIs regardless of the data integration approach used. And standard databinding APIs (fetchData / addData / updateData / removeData, and associated databound component methods) are almost always what make sense within an actual app.

          Regards
          Isomorphic Software

          Comment

          Working...
          X