Announcement

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

  • vitor.eduardods
    replied
    Originally posted by Blama View Post
    Hi Vitor,

    DynamicFrom is to display/edit one record (unlike ListGrid, which you can use to display/edit many records).
    So you'll always do a DF.fetch(criteria) that returns exactly 0 or 1 records. If you fetch via primaryKey, which is needed anyway for editing and unique by definition, you can solve your problem.
    You need to know which your current PK is (you can get that from the DF) and do your "next" fetch for PK+1 or your "previous"-fetch for PK-1. The "Start of list" is PK=1. The end of list is more tricky. You'll need to know which your last record is or - if you dont' know that - use some other 2-fetch-mechanism (pseudo code: maxPK=fetchMaxPK(), fetch(maxPK) on either client or server.

    Best regards
    Blama

    Hi Blama, thank you for your clarifications.

    I had an idea how to address the requirement. However, answer me another question: Is it possible to fill a datasource with a java.util.List? I have a list (come from another window) and I would like to use it as data for my datasource instead to fetch data from database. Is it possible?

    Leave a comment:


  • Blama
    replied
    Also have a look at the default BuiltInDS sample, which uses ListGrid + DynamicForm to select and edit a record.

    Leave a comment:


  • Blama
    replied
    Hi Vitor,

    DynamicFrom is to display/edit one record (unlike ListGrid, which you can use to display/edit many records).
    So you'll always do a DF.fetch(criteria) that returns exactly 0 or 1 records. If you fetch via primaryKey, which is needed anyway for editing and unique by definition, you can solve your problem.
    You need to know which your current PK is (you can get that from the DF) and do your "next" fetch for PK+1 or your "previous"-fetch for PK-1. The "Start of list" is PK=1. The end of list is more tricky. You'll need to know which your last record is or - if you dont' know that - use some other 2-fetch-mechanism (pseudo code: maxPK=fetchMaxPK(), fetch(maxPK) on either client or server.

    Best regards
    Blama

    Leave a comment:


  • vitor.eduardods
    replied
    Originally posted by Blama View Post
    Hi,
    • Use setNumCols(4) on your DF.
    • Use setColSpan(3) (3+1 for the title=4) on your normal data fields.
    • Use 4 ButtonItems, the latter ones with setStartRow(false). This will result in 4 buttons in one row.
    • Add ClickHandlers to the 4 ButtonItems. Do yourDF.fetch(some new criteria)
    Best regards
    Blama

    My problem is not to create the form and buttons. My problem is regarding the functionality itself. How to navigate? something like ds.next(), or ds.previous(), ds.last(), ds.first()

    Leave a comment:


  • Blama
    replied
    Hi,
    • Use setNumCols(4) on your DF.
    • Use setColSpan(3) (3+1 for the title=4) on your normal data fields.
    • Use 4 ButtonItems, the latter ones with setStartRow(false). This will result in 4 buttons in one row.
    • Add ClickHandlers to the 4 ButtonItems. Do yourDF.fetch(some new criteria)
    Best regards
    Blama

    Leave a comment:


  • How to navigate through the records in a data source?

    Hi all,

    I am newbie in SmartGWT. Now I have a form, and I will have a data source with many records and I need to navigate through the records in this data source. How can I do that? I need to implement controls actions as:

    |<< < > >>|

    Any idea??
Working...
X