My suggestions: 1) with a bit of javascript <form> <inputfield "selectedRowId"/> <button for action/>
<datatable> <commandlink onclick="setSelectedRowId('#{dbrow.Id}');call_submit_on_button_action();return false;"/> </datatable></form> 2) Create you own datatable component for showing datas, a component that will not iterate when it broadcasts for action. 3) Look in the net for a 'select row' jsf and datatable, there are plenty of tips there using javascript to choose a row to perform an action on. 4) check the net (tomahawk, myfaces sandbox, adf faces, trinidad?) for an existing component that goes around your problem (am sure such component has already been developped) Note datatable was meaned to show datas in ouput, not to create N input component. At least that how i see limitations on datatable. Behrang Saeedzadeh a écrit : > Hi all, > > What is the best practice to show h:commandLinks inside a h:dataTable > whose data are > fetched from a database (say, bound to #{TableBean.rows})? > > As you know, when I click on a commandLink inside a h:dataTable, the > TableBean's getRows is invoked again and this causes some serious > usability problems. > > I don't like storing the data in session scope. Also I cannot fetch > the data on every > request, because the result of the query that fetches data (select * > from FOO) can > change, as new rows might have been inserted to/removed from/updated > in the FOO table > in the time between the calls. > > t:saveState seems to be network-bandwidth-hungry because it serializes > the > #{TableBean.rows} to the client, and the client transfers it back to > the server on form > submit (am I right?) > > Regards, > Behi >