You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by raybristol <ra...@gmail.com> on 2007/11/08 11:13:22 UTC

DataView question, please help, thanks!

I am using DataView to show a list, in my html page, I got: 
	<table border='1' class="ms-prof-main">
					<tr>
							<th class="ms-prof-top">Box ID</th>
							<th class="ms-prof-top">Client name</th>
							<th class="ms-prof-top">Job profile</th>
							<th class="ms-prof-top">Box status</th>
							<th class="ms-prof-top">Store Location</th>
							<th class="ms-prof-top">Time in prep</th>
							<th class="ms-prof-top">Time in scan</th>
							<th class="ms-prof-top">Delete</th>
					</tr>
							<tr wicket:id="boxList">
								<td wicket:id ="boxID" class="ms-prof-even">boxID</td>
								<td wicket:id ="clientName" class="ms-prof-even">clientName</td>
								<td wicket:id ="JobProfileName"
class="ms-prof-even">JobProfileName</td>
								<td wicket:id ="BoxStatus" class="ms-prof-even">BoxStatus</td>
								<td wicket:id ="StoreLocation"
class="ms-prof-even">StoreLocation</td>
								<td wicket:id ="PreppedTime" class="ms-prof-even">PreppedTime</td>
								<td wicket:id ="ScannedTime" class="ms-prof-even">ScannedTime</td>
								<td class="ms-prof-even"> Delete </td>
					</tr>
	</table >

then in code behind I use protected void populateItem(Item item) to
specified each table cell's data, because I can put any String in td tag so
I can easily put any javascript function call, however, I want to do that
for each row as well, so the tr tag, such as when use click on a row,
something happen, but I can't find where I can put this ability from the
code behind?

Many thanks for your help!
-- 
View this message in context: http://www.nabble.com/DataView-question%2C-please-help%2C-thanks%21-tf4770079.html#a13644400
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DataView question, please help, thanks!

Posted by Dmitry Kandalov <no...@gmail.com>.
On Thursday 08 November 2007 14:13:22 raybristol wrote:
>         </table >
>
> then in code behind I use protected void populateItem(Item item) to
> specified each table cell's data, because I can put any String in td tag so
> I can easily put any javascript function call, however, I want to do that
> for each row as well, so the tr tag, such as when use click on a row,
> something happen, but I can't find where I can put this ability from the
> code behind?

You can add javascript file to the page header like this:
add(HeaderContributor.forJavaScript(MyPage.class, "myscript.js"));

And javascript calls like this:
add(new DataView("boxList", dataProvider)){
    protected void populateItem(Item item) {
        item.add(new SimpleAttributeModifier("onclick","row_clicked()"));
        item.add(new Label("boxID").add(new 
SimpleAttributeModifier("onclick","boxID_clicked()"));
        ...
    }
});


Dima

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org