I've been having some similar questions about datatable usage and general web "patterns", specifically walking a database and linking to detail pages with id values.

The detail of my questions are in my big post to javaranch...

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=82&t=000422

I worked with the O'Reilly book example, and that's where I originally came up with my issue. If you use the standard dataTable, you have to keep your values in session between the time you show the list and when they click on the value. If you get the values from the db each time, you open the possibility that the index will have changed, and the selected value will be incorrect. If you keep the values in session, its keeping a lot of data around, and you need to explicitly code a refresh.

I was pointed to the ext dataTable and the forceId (something something) attribute, which allows you to specify and id. This does solve the problem of inconsistancy. However, when the user submits, I assume you have to get the full list and then scan for the selected value. Yes?

I'll look into the <t:saveState>, as I haven't looked at that yet.

Anyway, I was also looking for some input as to a suggested way of handling this. In the above post, I outline how I've classically handled this type of issue. I'm hoping to find some insight into the best way to do that with JSF.

Thanks in advance,
-Kevin

CONNER, BRENDAN (SBCSI) wrote:
In answer to your second question, I believe you need <t:saveState> so JSF will rebuild the table in its component tree upon submitting the request, so you can access the values present in the previous request. - Brendan

    -----Original Message-----
    *From:* Rick Reumann [mailto:[EMAIL PROTECTED]
    *Sent:* Monday, August 29, 2005 9:22 AM
    *To:* MyFaces Discussion
    *Subject:* Concerning DataModel usage plus overhead?

    I haven't really used the DataModel class yet, but as described by
    Brendan in another thread, I have a couple of questions about the
    concepts behind it...

    First a simple example...

    Want to display on a page a list of employees. User should be able
    to click on employee and brought to an edit page to edit the employee.

    My question in a previous thread was how to best accomplish this. I
    figured a simple link passing in an  ID would make the most sense,
    but it seems like there was recommendations to use a dataModel. But
    say my initial ist was...

    Fred
    John
    Billy

    Questions:

    1) I want to click on one of those names and edit the user. This
    initial collection of employees shouldn't contain the full employee
    info - its just name and ID. It's way too much overhead to pull back
    the full employee information at this stage, so all I have as a name
    and an ID.

    2) Why would I want to really save the state of this tableData in
    this case using t:saveState since I really don't care about this
    list anymore once the name is clicked. I'm going to be brought to a
    totally new editEmployee screen and no longer need this collection
    around. When I want the updated list I should get it from the
    backend again.

    Please someone help me understand how to best accomplish what I want
    to do. It seems like such an easy concept but yet I haven't seen a
    good explanation or an example (granted I don't have the O'Reilly
    book, from what seems to be described I'm not certain that example
    will be what I want either).

    Thanks so much.

-- Rick

Reply via email to