SelectableListTableContentProvider and index of sorted rows


I use a SelectableListTableContentProvider to display the values of an Array of self defined POJOs over an Async Table.
The Sort property is set to 1 for the first column of the table => The order of the diplayed values is different of the order of the values in my Array.

And now my Question: How can I get the value associated with the first row of the table? My goal is to select the first row of the table after initialization.

For now I do the following:

in the portlet initialize() method: Call a service to get the values for my POJO Array
The output Array of the service is used as values array by the SelectableListTableContentProvider
The value attribute of the Async Table is set to the SelectableListTableContentProvider
The first column of my table is bound to the name attribute of my POJO (over the control scoped variables)
The sort property of the first column of my table is set to 1

Thanks for hints

Just to be sure, are you asking for server side access to the first row After it has been sorted?

Yes, exactly.

I need the values of the first row of the sorted table in order to call another service that get details data for the selected row.
When my portlet is first shown I use the initialize() method of my portlet to set up the data for the tableProvider and the bean containing detail-data over the selected row.
Later the user will select a row of the table over a async-command-link, so that I can get the currentRow or selectedRow over the provider, but at the portlet initialization time, the user has not selected any row yet.

Ok, it seems like you can just use the binding expression of the Content Provider (if it is used after the table control).

In the sample app attached, i have a list of values in random order. The Table Control sorts the table, and then in a property group right afterwards the content provider’s current row is bound to some text boxes. In your example, it seems like you could bind the content provider’s first row data to your web service.

Please have a look and see if it makes sense in your scenario.
–mark (12.5 KB)

hi mark,
In the above sample given , onclick of any “id’s” given by the selectlistTableContentProvider can i call the other service to fetch the details of it? how can i achieve that?

Hi Mark,

thanks for the hint.
I was not able to run your sample, probably because I’m using MWS 7.1.3.
But I was able to reproduce the sample on my environment using your sample’s code content.

So, I’m yet able to get the value of the first row of my sorted table through this code snipet:

protected void afterRenderResponse() {
	String boundValue = (String) resolveExpression("#{}");
            // I Call my service here using the retrieved ID

The only problem remaining is that my portlet has already been displayed at this phase, and I don’t get the results of the service displayed before I refresh the portlet page.
Do you know any way to force an automatic refresh of the page after the service call? Maybe over java-script?

By the way: I’ve checked the value returned by the EL-expression of the code snippet above for other phases. The value returned during before-render-response was the first value of the provider list. Only after the rendering of the table, the value was changed to the first row of the table.


Have a look at this javascript here: Slow page - webMethods - Software AG Tech Community & Forums

It shows how to raise a command after the Dom is loaded.

Hi Mark,

do you maybe have a sample portlet with this script working. I don’t manage to get the custom script control trigered after my portlet page is loaded.


Please see the attached sample. (11.9 KB)