menambahkan link pada grid tapestry5

Untuk file .tml

 <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">

<t:grid t:source="listbarang" t:row="barang">
 <t:parameter name="nama_barangcell">
 <t:actionlink t:id="gotodetail" t:context="${barang.id_barang}">${barang.nama_barang}</t:actionlink>
 </t:parameter>
 </t:grid>

</html>

Sedangkan file .java

package com.example.tutorial.pages;

import java.util.ArrayList;
 import java.util.List;

import org.apache.tapestry5.annotations.Property;
 import org.apache.tapestry5.annotations.SetupRender;

import com.example.tutorial.entities.Barang;

public class VariasiKomponen {

private List listBarang;

@Property
 private Barang barang;

@SetupRender
 void setupRender(){
 if (barang == null)
 barang = new Barang();
 }

public List getListBarang(){
 listBarang = new ArrayList();
 listBarang.add(new Barang("1", "Lifebouyz", "Rp 2300"));
 listBarang.add(new Barang("2", "Shinzuis", "Rp 3500"));
 listBarang.add(new Barang("3", "Pepcodent", "Rp 3500"));
 listBarang.add(new Barang("4", "Clearz", "Rp 7500"));
 return listBarang;
 }

void onActionFromGotoDetail(String id_barang){

}

}

Hasilnya adalah
link pada grid

Published by

saifiahmada

Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s