voyent
CurrentRow in IceFaces?  XML
Forum Index -> Woodstock to ICEfaces Migration
Author Message
rnf1

Joined: 16/Nov/2006 00:00:00
Messages: 7
Offline


Hi All,

In woodstock tables you could use currentRow or get the current row from a rowGroup to put data in tables.

How is that done in IceFaces?

I have a table bound to a MySQL database table. I created a new column to put retail price in. I want to be able to get wholesale price from the database and multiply it by a markup factor and put the result into my new column in the table (retail price), and do this for each row in the table, and have it stay coherent id the table is sorted.

Thanks
tyler.johnson


Joined: 18/Apr/2007 00:00:00
Messages: 93
Offline


Hi,

How is your markup event triggered? Is it through a change in application state or through direct user interaction?

If it's through a change in application state, I would recommend reviewing our 'GroupAsyncRenderer Implementations' section in the server initiated rendering (Ajax Push) portion of our developers guide:

http://www.icefaces.org/docs/v1_7_2/htmlguide/devguide/AdvancedTopics3.html#999326

This section contains an example of how to use our onDemandRenderer capabilities. It has a fictitious stockEventListener that listens for stock event updates and when one is received, will perform any required logic and requestRender to push out updates to the UI. You will want to follow this same idea.

Now if this event is triggered by direct user interaction such as a button click, you could simply manipulate your dataTable model in the action method.

Thanks,

Tyler

rnf1

Joined: 16/Nov/2006 00:00:00
Messages: 7
Offline


tyler.johnson wrote:
Hi,

How is your markup event triggered? Is it through a change in application state or through direct user interaction?

If it's through a change in application state, I would recommend reviewing our 'GroupAsyncRenderer Implementations' section in the server initiated rendering (Ajax Push) portion of our developers guide:

http://www.icefaces.org/docs/v1_7_2/htmlguide/devguide/AdvancedTopics3.html#999326

This section contains an example of how to use our onDemandRenderer capabilities. It has a fictitious stockEventListener that listens for stock event updates and when one is received, will perform any required logic and requestRender to push out updates to the UI. You will want to follow this same idea.

Now if this event is triggered by direct user interaction such as a button click, you could simply manipulate your dataTable model in the action method.

Thanks,

Tyler

 


This is on initial rendering. In the tables with Netbeans VWF you could create a table , then add a column of checkboxes. You then bound the selected state of the checkbox to a boolean. In the getter method for that boolean. When the table is rendered the getter method of the boolean is called for each row in the table. Inside the getter method you could put code that looked at other columns to calculate the state of the checkbox.

You could use something like this to set the selected state of the checkbox:
String productSoldStr = (String) getValue({currentRow.value['PRODUCT_ID']}");

if (productIDStr.equals("SOLD")
return true;
else return false;

Is there something similar to theis in IceFaces?
mkat

Joined: 16/Oct/2008 00:00:00
Messages: 96
Offline


I'm not sure if this is exactly what you are asking, but as I converted tables from woodstock to icefaces, I only had to make this change:

Instead of say currentRow.value['description'] use the format: currentRow['description']

and if you can do like this too: currentRow['userid'].username
jialles

Joined: 18/Dec/2008 00:00:00
Messages: 10
Offline


Hello,

here is a code snippet ( by using persistence ) to get the value in a second database table, based on a datatable row value:


protected String locationTxt;

/**
* Get the value of locationTxt
*
* @return the value of locationTxt
*/
public String getLocationTxt()
{
locationTxt = "Unbekannt";
try
{
Object value = getValue("#{currentRow['ID_LOCATION']}");
if (null != value)
{
TPrelocations_Controller tprelocations_Controller = new TPrelocations_Controller();
TPrelocations[] tprelocations = tprelocations_Controller.getTPrelocationsbyID(Integer.parseInt(value.toString()));
if (tprelocations.length > 0)
{
locationTxt = tprelocations[0].getLocationtxt();
}
}

} catch (Exception ex)
{
error(ex.getMessage());
info("Lesefehler Firmen-Standortname.");
}
return locationTxt;
}


And here we have the .jsp:

<ice:column id="columnID_LOCATION">
<ice:outputText id="outputText5" value="#{yourpage.locationTxt}"/>
<f:facet name="header">
<ice:outputText id="outputText6" value="Firmen-Standort:"/>
</f:facet>
</ice:column>

Hope this helps,

HJ. Alles
rnf1

Joined: 16/Nov/2006 00:00:00
Messages: 7
Offline


jialles wrote:
Hello,

here is a code snippet ( by using persistence ) to get the value in a second database table, based on a datatable row value:


protected String locationTxt;

/**
* Get the value of locationTxt
*
* @return the value of locationTxt
*/
public String getLocationTxt()
{
locationTxt = "Unbekannt";
try
{
Object value = getValue("#{currentRow['ID_LOCATION']}");
if (null != value)
{
TPrelocations_Controller tprelocations_Controller = new TPrelocations_Controller();
TPrelocations[] tprelocations = tprelocations_Controller.getTPrelocationsbyID(Integer.parseInt(value.toString()));
if (tprelocations.length > 0)
{
locationTxt = tprelocations[0].getLocationtxt();
}
}

} catch (Exception ex)
{
error(ex.getMessage());
info("Lesefehler Firmen-Standortname.");
}
return locationTxt;
}


And here we have the .jsp:

<ice:column id="columnID_LOCATION">
<ice:outputText id="outputText5" value="#{yourpage.locationTxt}"/>
<f:facet name="header">
<ice:outputText id="outputText6" value="Firmen-Standort:"/>
</f:facet>
</ice:column>

Hope this helps,

HJ. Alles 


Thanks jailes and mkat. That's what I needed.

Rick
 
Forum Index -> Woodstock to ICEfaces Migration
Go to:   
Powered by JForum 2.1.7ice © JForum Team