Re: adding sub rows to AjaxFallbackDefaultDataTable

2010-12-21 Thread Benedikt Schlegel
First, I never used the tree table from wicket-extensions. But i had a
very quick look at the code and had the following idea.

You could try to extend the TreeTable so you can provide your own
TreeFragment. This ExtendedTreeFragment could render different
components depending on the 'level' parameter (e.g. the default
TreeFragment for level 1 and a special details table component for
level 2).

2010/12/21 fachhoch fachh...@gmail.com:

 tree table will not work ,  I need a table in the sub row,if I use tree table
 I cannot have header for the table.
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/adding-sub-rows-to-AjaxFallbackDefaultDataTable-tp3095096p3112645.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: adding sub rows to AjaxFallbackDefaultDataTable

2010-12-20 Thread Alexander Morozov

Suggest another approach:

class MasterTableT extends DefaultDataTableT {

public MasterTable(...) {
  setItemReuseStrategy(new MasterTableReuseStrategy(this));
}

protected ItemT newDetailsRow(...) {
  /* create row here */
}

protected void populateDetailsRow(...) {
  /* populate details (cells) here by means of Panel of Fragment */
}

}

class MasterTableReuseStrategy implements IItemReuseStrategy {
  @Override
  public T IteratorItemT getItems(final IItemFactoryT factory, final
IteratorIModelT newModels,
  final IteratorItemT existingItems) {
return new IteratorItemT() {

  private int index = 0;
  private IModelT currentMasterRowModel = null;

  public boolean hasNext() {
return currentMasterRowModel != null || newModels.hasNext();
  }

  public ItemT next() {
if (currentMasterRowModel != null) {
  ItemT row = table.newDetailsRow(..., index++,
currentMasterRowModel);
  table.populateDetailsRow(row, ...);
  currentMasterRowModel = null;
  return row;
}
currentMasterRowModel = newModels.next();
return factory.newItem(index++, model);
  }

};
  }
}

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-sub-rows-to-AjaxFallbackDefaultDataTable-tp3095096p3095919.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: adding sub rows to AjaxFallbackDefaultDataTable

2010-12-20 Thread Benedikt Schlegel
Hi Alexander,
would you mind to give a short explanation of the logic in
MasterTableReuseStrategy?

Thanks

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



Re: adding sub rows to AjaxFallbackDefaultDataTable

2010-12-20 Thread James Carman
Have you thought about using a tree table
On Dec 19, 2010 11:42 PM, fachhoch fachh...@gmail.com wrote:

 I want to insert row with column spanning

 My datatable lists master record in each row , I want to display detail
 record in the next row when user click on master record for which I tought
 of using expand table rows with jquery plugin

 I found this post which will help me here is the ocde form the post


 new AjaxFallbackDefaultDataTableMyCustomObject(
 id, columns, dataProvider, rowsPerPage){

 @Override
 protected ItemMyCustomObject newRowItem(String id,
 int index,
 final IModelMyCustomObject model){
 ItemMyCustomObject item = super.newRowItem(id, index, model);
 item.add(new AbstractBehavior(){

 private static final long serialVersionUID = 1L;

 /**
 * {...@inheritdoc}
 */
 @Override
 public void onRendered(Component component){
 if(model.getObject().isEpicFail()){
 component.getResponse().write(
 trtd colspan=\3\This is an epic fail/td/tr);
 }
 }

 });
 return item;
 }

 private static final long serialVersionUID = 1L;

 }

 in the above example I am writing some html to create the additional row ,
 I am wondering if I can get the generated markup of a panel and feed it to
 the write method ?

 --
 View this message in context:
http://apache-wicket.1842946.n4.nabble.com/adding-sub-rows-to-AjaxFallbackDefaultDataTable-tp3095096p3095096.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



Re: adding sub rows to AjaxFallbackDefaultDataTable

2010-12-20 Thread fachhoch

tree table will not work ,  I need a table in the sub row,if I use tree table
I cannot have header for the table.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-sub-rows-to-AjaxFallbackDefaultDataTable-tp3095096p3112645.html
Sent from the Users forum mailing list archive at Nabble.com.

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



adding sub rows to AjaxFallbackDefaultDataTable

2010-12-19 Thread fachhoch

I want   to   insert row with column spanning 

My datatable lists master record in each row , I want to display detail
record in the next row   when user click on master record for which I tought
of using expand table rows with jquery plugin

I found this post which will help me here is the ocde form the post


new AjaxFallbackDefaultDataTableMyCustomObject(
id, columns, dataProvider, rowsPerPage){

@Override
protected ItemMyCustomObject newRowItem(String id,
int index,
final IModelMyCustomObject model){
ItemMyCustomObject item = super.newRowItem(id, index, model);
item.add(new AbstractBehavior(){

private static final long serialVersionUID = 1L;

/**
 * {...@inheritdoc}
 */
@Override
public void onRendered(Component component){
if(model.getObject().isEpicFail()){
component.getResponse().write(
trtd colspan=\3\This is an epic fail/td/tr);
}
}

});
return item;
}

private static final long serialVersionUID = 1L;

}

in the above example I am writing some html to create  the additional row ,
I am wondering if I can get the generated markup of a panel and feed it to
the write method ? 

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-sub-rows-to-AjaxFallbackDefaultDataTable-tp3095096p3095096.html
Sent from the Users forum mailing list archive at Nabble.com.

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