Re: IE8 + No Page found for component

2011-04-12 Thread Thierry Peng

On 04/12/2011 03:20 PM, Tejash Tarun wrote:

Hi,

I am using tabs in my page.

When switching between the tabs I get this exception frequently (and not
every time).

java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = link]]
at org.apache.wicket.Component.getPage(Component.java:1819)
at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:284)

...


Previously I faced the problem of difference of client-side state and
server-side state with chrome and got a fix implementing the solution at
this link:
http://www.richardnichols.net/2010/03/apache-wicket-force-page-reload-to-fix-ajax-back/

But now I see the simple switching between the tabs in IE8 gives me the
problem.

OS used: Windows7
Browser: IE8

Seeking help.

Thanks in advance,
Tejash


that's most probably a problem with the component hierarchy.

If you call getPage() on a component that is (not yet or not anymore) 
added to another component this exception happens.


A possible Condition can be:

someSubmitMethod(ajaxtarget target){
if(someLogicDecides())
{
this.addOrReplace(new OtherPanel())
target.addComponent(getPage()); //= this getPage() cannot succeed
}
}

this may be not your case but there are many similar conditions with 
replace mechanism where this may happen. Look for replace mechanism and 
check them.


greetings

thierry

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



Re: IE8 + No Page found for component

2011-04-12 Thread Thierry Peng

On 04/12/2011 04:36 PM, Thierry Peng wrote:

On 04/12/2011 03:20 PM, Tejash Tarun wrote:

Hi,

I am using tabs in my page.

When switching between the tabs I get this exception frequently (and not
every time).

java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = link]]
at org.apache.wicket.Component.getPage(Component.java:1819)
at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:284) 



...


Previously I faced the problem of difference of client-side state and
server-side state with chrome and got a fix implementing the solution at
this link:
http://www.richardnichols.net/2010/03/apache-wicket-force-page-reload-to-fix-ajax-back/ 



But now I see the simple switching between the tabs in IE8 gives me the
problem.

OS used: Windows7
Browser: IE8

Seeking help.

Thanks in advance,
Tejash


that's most probably a problem with the component hierarchy.

If you call getPage() on a component that is (not yet or not anymore) 
added to another component this exception happens.


A possible Condition can be:

someSubmitMethod(ajaxtarget target){
if(someLogicDecides())
{
this.addOrReplace(new OtherPanel())
target.addComponent(getPage()); //= this getPage() cannot succeed
}
}

this may be not your case but there are many similar conditions with 
replace mechanism where this may happen. Look for replace mechanism 
and check them.


greetings

thierry

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


correction:

someSubmitMethod(ajaxtarget target){
if(someLogicDecides())
{
this.replaceWith(new OtherPanel())
target.addComponent(getPage()); //= this getPage() cannot succeed
}
}

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



textarea

2011-03-30 Thread Thierry Peng

Quick question about textareas

I have on a panel two component, a textarea with a xml and a label. the 
label gets updated (via ajax)but the textarea not.


form2.add(area = new TextAreaString(userdata, new 
LoadableDetachableModelString() {

  @Override
  protected String load() {
  log.debug(loading in  area called);
return currentAccount.getUserdata();
  }
}));

form2.add(new Label(current, new LoadableDetachableModelString() {
  @Override
  protected String load() {
log.debug(loading in  area called);
return Ausgewählter Benutzer:  + currentAccount.getAccountName();
  }
}

the ajaxtarget is the parent of both components (the parent of the form2 
exactly). the loading in area called appears only once in the log, the 
other always. Does the textarea do some sort of caching?


greetings

thierry

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



Re: textarea

2011-03-30 Thread Thierry Peng

On 03/30/2011 11:19 AM, Martin Grigorov wrote:

no, it doesn't cache
it seems the textarea is not involved at all in the ajax request processing
and its model is not needed

On Wed, Mar 30, 2011 at 10:52 AM, Thierry Pengp...@glue.ch  wrote:


Quick question about textareas

I have on a panel two component, a textarea with a xml and a label. the
label gets updated (via ajax)but the textarea not.

form2.add(area = new TextAreaString(userdata, new
LoadableDetachableModelString() {
  @Override
  protected String load() {
  log.debug(loading in  area called);
return currentAccount.getUserdata();
  }
}));

form2.add(new Label(current, new LoadableDetachableModelString() {
  @Override
  protected String load() {
log.debug(loading in  area called);
return Ausgewählter Benutzer:  + currentAccount.getAccountName();
  }
}

the ajaxtarget is the parent of both components (the parent of the form2
exactly). the loading in area called appears only once in the log, the
other always. Does the textarea do some sort of caching?

greetings

thierry

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




the problem was the page architecture. the page had two panels, an 
overview wmc with an inmethodgrid for all account registered in the 
application and a detail wmc with the the textarea. if someone clicked 
on an account displayed in the grid then the overviewpanel was made 
invisible and the detailpanel was made visible. the detailpanel had a 
submit and a cancelbutton.


if an user pressed the cancel button(formprocessing false) on the 
detailpanel, and selected another account on the overviewpanel, he saw 
the details (textarea) of the first account.
As it seems only the readonly part (the label) was reloaded and the 
textarea not. But I can't explain this behaviour. It seems that the 
model on these components didn't pickup the modelobject change even when 
the modelchanging()/modelchanged() was fired.


however, I solved this problem with a replace panel strategy instead of 
the isvisible strategy. works like a charm this way.


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



Re: Hints for creating a form-embedded Grid

2010-11-10 Thread Thierry Peng

MattyDE schrieb:

As i mentioned in a another thread i build my own GridView Component from
Scratch (just extending Panel).
But now our customer want a special, editable Grid.

Its no problem on my side to add TextboxColumns, DropDownColumns and so
on, but i cant figure out how to connect them to a special form.

I have tried to add my whole GridView Component (which is the container of
the Textbox, DropDown, any FormComponent) and submit this form.

In FireBug i see that all this Components are send by Ajax-Request to the
server-side. But will they end in the FormComponents automatically by
Wicket-internal-Form-Processing?

If this is true, iam almost done (i think ;) )

Any other hints for develop a form-embedded Grid?
  

Hello Matty

have a look at the inmethod-grid 
http://wicketstuff.org/confluence/display/STUFFWIKI/Inmethod+Grid in 
wicketstuff


It contains the editable feature, works out of the box and is easily 
extendable.


greetings

thierry

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



Re: Which component to use for Data Grid's with selectable items?

2010-09-30 Thread Thierry Peng

It is ASL2

from the inmethod-grid-parent pom:
licenses
   license
   nameThe Apache Software License, Version 2.0/name
   urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url
   distributionrepo/distribution
   /license
   /licenses

I don't know about the state of the art in terms of grids but I'm 
using this library in several projects and it works fine and is easely 
extendable. So I didn't have any reason to search for an alternative.


thierry

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



AbstractDefaultAjaxBehavior - Could not find root ajax-response element

2010-08-19 Thread Thierry Peng

Hello

I have a resourcelink where I need to add an ajaxcallback to recalculate and 
update the current panel.
I added an AbstractDefaultAjaxBehavior to that link with the callback, but the 
respond method was never invoked.
In the wicket ajax debug i saw the following input: 



*INFO: *Using XMLHttpRequest transport

*INFO: *

*INFO: *Initiating Ajax GET request on 
?wicket:interface=:0:middle:link::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=truefoo=barrandom=0.6376184095942993

*INFO: *Invoking pre-call handler(s)...

*INFO: *Received ajax response (0 characters)

*INFO: *

*ERROR: *Wicket.Ajax.Call.failure: Error while parsing response: Could not find root 
ajax-response element

*INFO: *Invoking post-call handler(s)...

*INFO: *Invoking failure handler(s)...

behavior:

final AbstractDefaultAjaxBehavior behave =new AbstractDefaultAjaxBehavior()
   {
 @Override
 protected void respond(AjaxRequestTarget arg0)
 {
   log.debug(respond called);
   repaint();
   arg0.addComponent(self);
 }
 @Override
 protected void onComponentTag(ComponentTag tag)
 {
   super.onComponentTag(tag);
   log.debug(on componenttag called);
   String javascript = wicketAjaxGet(' + getCallbackUrl()
 + foo=bar', function() { }, function() { });;
   tag.put(onClick, javascript);
 }
   };

resourcelink:
add(link = new ResourceLinkVoid(link, new DynamicWebResource()
   {
 @Override
 protected void setHeaders(WebResponse response)
 {
   super.setHeaders(response);
   response.setAttachmentHeader(auszug.zip);
 }

 @Override
 protected ResourceState getResourceState()
 {
   return new ResourceState()
   {
 byte[] data;

 @Override
 public byte[] getData()
 {
   if (data == null)
   {
 try
 {
   data = builderservice.getDataAsZip(rawdata);
   log.debug(length of data: +data.length);
 } catch (SystemException e)
 {
   log.fatal(systemexception occured, e);
 }
   }
   return data;
 }
 @Override
 public String getContentType()
 {
   return application/zip;
 }
   };
 }
   })
   );
   link.add(new Label(label, new 
ResourceModel(middle.mailbox.download.all)));
   link.add(behave);

html (as it appears in the browser):

/form
a id=link5e href=?wicket:interface=:0:middle:link::IResourceListener:: 
view-source:http://localhost:8080/postfach/?wicket:interface=:0:middle:link::IResourceListener:: 
onclick=wicketAjaxGet('?wicket:interface=:0:middle:link::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=true', function() { 
}, function() { });spanAlle Dokumente herunterladen/span/a
/div/td
td/td/tr
/table
/td/tr/table/tdtdnbsp;/td/tr/table
/body
/html

Any ideas to how to solve this problem?

greetings


thierry


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



Re: AbstractDefaultAjaxBehavior - Could not find root ajax-response element

2010-08-19 Thread Thierry Peng
Some additional info;rmation; this error occurs with the mozilla firefox 
3.6.8 while the same code works with the internet explorer 8. Now I'm 
really confused...


I works also with chrome v5 and opera 10.10

Thierry Peng schrieb:

Hello

I have a resourcelink where I need to add an ajaxcallback to 
recalculate and update the current panel.
I added an AbstractDefaultAjaxBehavior to that link with the callback, 
but the respond method was never invoked.

In the wicket ajax debug i saw the following input:

*INFO: *Using XMLHttpRequest transport

*INFO: *

*INFO: *Initiating Ajax GET request on 
?wicket:interface=:0:middle:link::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=truefoo=barrandom=0.6376184095942993 



*INFO: *Invoking pre-call handler(s)...

*INFO: *Received ajax response (0 characters)

*INFO: *

*ERROR: *Wicket.Ajax.Call.failure: Error while parsing response: Could 
not find root ajax-response element


*INFO: *Invoking post-call handler(s)...

*INFO: *Invoking failure handler(s)...

behavior:

final AbstractDefaultAjaxBehavior behave =new 
AbstractDefaultAjaxBehavior()

   {
 @Override
 protected void respond(AjaxRequestTarget arg0)
 {
   log.debug(respond called);
   repaint();
   arg0.addComponent(self);
 }
 @Override
 protected void onComponentTag(ComponentTag tag)
 {
   super.onComponentTag(tag);
   log.debug(on componenttag called);
   String javascript = wicketAjaxGet(' + getCallbackUrl()
 + foo=bar', function() { }, function() { });;
   tag.put(onClick, javascript);
 }
   };

resourcelink:
add(link = new ResourceLinkVoid(link, new DynamicWebResource()
   {
 @Override
 protected void setHeaders(WebResponse response)
 {
   super.setHeaders(response);
   response.setAttachmentHeader(auszug.zip);
 }

 @Override
 protected ResourceState getResourceState()
 {
   return new ResourceState()
   {
 byte[] data;

 @Override
 public byte[] getData()
 {
   if (data == null)
   {
 try
 {
   data = builderservice.getDataAsZip(rawdata);
   log.debug(length of data: +data.length);
 } catch (SystemException e)
 {
   log.fatal(systemexception occured, e);
 }
   }
   return data;
 }
 @Override
 public String getContentType()
 {
   return application/zip;
 }
   };
 }
   })
   );
   link.add(new Label(label, new 
ResourceModel(middle.mailbox.download.all)));

   link.add(behave);

html (as it appears in the browser):

/form
a id=link5e 
href=?wicket:interface=:0:middle:link::IResourceListener:: 
view-source:http://localhost:8080/postfach/?wicket:interface=:0:middle:link::IResourceListener:: 
onclick=wicketAjaxGet('?wicket:interface=:0:middle:link::IActivePageBehaviorListener:0:wicket:ignoreIfNotActive=true', 
function() { }, function() { });spanAlle Dokumente 
herunterladen/span/a

/div/td
td/td/tr
/table
/td/tr/table/tdtdnbsp;/td/tr/table
/body
/html

Any ideas to how to solve this problem?

greetings


thierry


-
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



getPage() Question

2010-08-13 Thread Thierry Peng

Hi

I have a Singlepage Application where I swap some panels on the main 
page depending what the user does. Specifically I have a Panel for 
changing the password which looks like:



@SuppressWarnings(serial)
public class ChangePasswordPanel extends Panel
{
 @Inject
 private ChangePasswordAction action;

 @Inject
 private AmtUserHome home;



 @SuppressWarnings(unchecked)
 public ChangePasswordPanel(String id)
 {
   super(id);
   this.setOutputMarkupId(true);

.. some fields added here

   Button change = new Button(change, new 
ResourceModel(middle.changepw.change))
   {
 @Override
 public void onSubmit()
 {
   getPage().addOrReplace(new ChangePasswordSuccessPanel(middle));
   action.saveChanges(); 
   super.onSubmit();

 }
   };
   ..some code
   Button cancel = new Button(cancel, new 
ResourceModel(middle.changepw.cancel))
   {
 @Override
 public void onSubmit()
 {
   
   getPage().addOrReplace(new ChangePasswordPanel(middle));

   getPage().addOrReplace(new ChangePasswordInformationPanel(right));
   super.onSubmit();
 }

 @Override
 public boolean isVisible()
 {
   PostfachModel model = session.getModel();
   return !model.isNeedsPasswordChange();
 }
   };

   cancel.setDefaultFormProcessing(false);
   
.. some more code


   add(form);
   
   container.add(oldPassword);

   form.add(cancel, change, text, password, passwordrepeat, container);

 }
}


However, I'm encountering the following exception:

java.lang.IllegalStateException: No Page found for component [MarkupContainer 
[Component id = cancel]]
at org.apache.wicket.Component.getPage(Component.java:1756)
at 
ch.admin.bj.ba.postfach.ui.panels.ChangePasswordPanel$5.onSubmit(ChangePasswordPanel.java:102)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:882)

But only when I click the cancel button (102 points to 

getPage().addOrReplace(new ChangePasswordInformationPanel(right));

). The submit(change) button works fine and I'm using in both 
onsubmit() almost the identical code. Is there any explanation for this 
behaviour? The buttons in the html are identical:


input type=submit class=button wicket:id=change/
input type=submit class=button wicket:id=cancel/

Wicket version is 1.4.9 on a glassfish 3

Thanks in advance

thierry



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



Re: getPage() Question

2010-08-13 Thread Thierry Peng

I figured it out.

For who is interested:

The first getPage().addOrReplace replaced the middlepanel which was also 
the current changepasswordpanel.
The second call on getParent() can only yield null because the panel in 
question was already swapped.


So there are two valid solutions:

first use the var-arg:

getPage().addOrReplace( new MiddleInfoPanel(middle),new 
LoginPanel(right));


second, swap first the right panel, then the middle panel

getPage().addOrReplace(new LoginPanel(right));
getPage().addOrReplace(new MiddleInfoPanel(middle));



both solutions works and my faith in wicket is saved

silly me

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



Re: inmethod grid / Delete/add a row?

2010-04-28 Thread Thierry Peng

Hello

I solved this problem some months ago and created a 
SubmitCancelDeleteColumn. A custom Grid Class provides the possibility 
to add a row.

I had to fork the inmethod-grid because some changes were necessary.
Drop me an email if you want the source code of this fork and the client 
code.


greetings


Swanthe Lindgren schrieb:
The row model is probably easily accessible from your proposed delete 
column, but I don't know how to rerender a single row.


//Swanthe

On 2010-04-27 17:48, nino martinez wael wrote:

True... I am in the process of doing my own delete column, and expect
to have it working by tomorrow. I just need to be able to mark the
item dirty, somehow I either use the wrong model or the grid does not
pick it up. On either account it does not remove the delete row until
a manual refresh as is now.

regards Nino

2010/4/27 Swanthe Lindgrenswanthe.lindg...@megasol.se:
  
That is a part of the inmethod grid I find very hard, as its based 
solely on
a list of models. I haven't even found a way to know which row is 
selected,
even less which row is next to the selected row, which can be very 
useful
information when you wish to insert a row or select the row 
before/after the

row you just removed.

//Swanthe

On 2010-04-26 16:00, nino martinez wael wrote:


Hi

Are there any built in functionality to delete or add rows with
inmethod grid? Or should I just roll my own?

regards Nino

-
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


 

-
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



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



Re: TextField hosting an Integer

2010-03-22 Thread Thierry Peng

Steven Haines schrieb:

Hi,

I'm creating a text field to host an integer, namely the year that a house was 
built:
TextFieldInteger yearBuilt = new TextFieldInteger( yearBuilt 
).setRequired( true );

And I'm using a CompoundPropertyModel that maps yearBuilt to an underlying bean property. My problem is that the default value for an integer is 0, so the text field pre-populates its value to 0, which is a rather silly year built date ;)  What I would like to do is mark the field as required and validate against a number range, but display the text field without an initial value. 


I know I can make it a TextFieldString and then validate on submission, but what has me intrigued is my exploration 
into the DropDownChoice and the creation of renderers. For example, I have a dropdown list from which a user can choose a 
value between 0 and 50,000 (increments of 1000), but I built a custom renderer that displays No Coverage for 
0 (insurance industry.) Can I build a custom renderer for the initial value of a text field so that if I see 
0 I return , otherwise I return the actual value, e.g. 2001?

Thanks in advance,
Steve


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

  

overwrite the getConverter on your textfield

@Override
   public IConverter getConverter(Class? type)
   {
 NumberConverter fc = new NumberConverter()
 {
   @Override
   public String convertToString(Object value, Locale locale)
   {
   //insert your conversion logic here
   }
 };
 return fc;
   }

best

--
Thierry Peng


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



Re: InMethod Grid: resizing rowcount

2010-03-15 Thread Thierry Peng

Pointbreak schrieb:

The public interface of the inmethod DataGrid/DefaultDataGrid does not
seem to provide functionality to expand the number of rows after an
ajax-call that e.g. adds data to the underlying datasource. Is there a
way to tell the DataGrid that the underlying datasource may have
changed, to the effect that the existing row count is not valid anymore?
I.e. like markAllItemsDirty(), but then telling the grid to reload the
entire underlying model, including rowcount, instead of only the
individual rows?

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

  
I tackled a similar problem (an add button for an editable datagrid) 
the following way:


- create a new object with reflection
- insert it in the backing list (model)
- call update on the grid
- add the grid to the requesttarget

public class MyDataGrid extends DecoratedDataGrid
{
protected List rawList;

protected final Class modelAsClass;

public MyDataGrid(String id, String title, String buttonTitle, List? list,
 ListIGridColumn columns, final Class? modelAsClass)
 {
   super(id, title, buttonTitle, new MyDataProviderAdapter(new 
ListDataProvider(list)),

   columns, modelAsClass);
   log.debug(creating grid for type  + modelAsClass.getSimpleName()
   +  no of columns:  + columns.size() +  size of datalist:  + 
list.size());

   this.rawList = list;
 }

@Override
protected void onAddRow(AjaxRequestTarget target, Form? form)
 {
   Object obj = modelAsClass.newInstance();

   rawList.add(obj);
   log.debug(object of class  + modelAsClass.getName() +  
successfully inserted);

   update();
   target.addComponent(getGrid());
 }
}

This takes place in a custom subclass of the defaultdatagrid. The 
onAddRow method is called from an ajaxbutton (onsubmit)

I hope this helps

--
Thierry Peng
  __  _
 / / /   / / / / /   GLUE Software Engineering AG
/ / __/ /   / / / / __/ Zieglerstr. 34, 3007 Bern,  Switzerland
/ /_/ / /___/ /_/ / /___Phone: +41-(0)31/385 30 34Fax: 30 18
\/_/\/_/___mailto: p...@glue.ch


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



Re: InMethod Grid: resizing rowcount

2010-03-15 Thread Thierry Peng

Pointbreak schrieb:

On Mon, 15 Mar 2010 15:06 +0100, Thierry Peng p...@glue.ch wrote:
  

Pointbreak schrieb:


The public interface of the inmethod DataGrid/DefaultDataGrid does not
seem to provide functionality to expand the number of rows after an
ajax-call that e.g. adds data to the underlying datasource. Is there a
way to tell the DataGrid that the underlying datasource may have
changed, to the effect that the existing row count is not valid anymore?
I.e. like markAllItemsDirty(), but then telling the grid to reload the
entire underlying model, including rowcount, instead of only the
individual rows?

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

  
  
I tackled a similar problem (an add button for an editable datagrid) 
the following way:


- create a new object with reflection
- insert it in the backing list (model)
- call update on the grid
- add the grid to the requesttarget

public class MyDataGrid extends DecoratedDataGrid
{
 protected List rawList;

 protected final Class modelAsClass;

public MyDataGrid(String id, String title, String buttonTitle, List?
list,
  ListIGridColumn columns, final Class? modelAsClass)
  {
super(id, title, buttonTitle, new MyDataProviderAdapter(new 
ListDataProvider(list)),

columns, modelAsClass);
log.debug(creating grid for type  + modelAsClass.getSimpleName()
+  no of columns:  + columns.size() +  size of datalist:  + 
list.size());

this.rawList = list;
  }

 @Override
 protected void onAddRow(AjaxRequestTarget target, Form? form)
  {
Object obj = modelAsClass.newInstance();

rawList.add(obj);
log.debug(object of class  + modelAsClass.getName() +  
successfully inserted);

update();
target.addComponent(getGrid());
  }
}

This takes place in a custom subclass of the defaultdatagrid. The 
onAddRow method is called from an ajaxbutton (onsubmit)

I hope this helps

--
Thierry Peng



You must be doing something else in addition to that (or I am missing
something). As far as I can see, the DefaultDataGrid class will not ask
its model/datasource for a new rowcount when you call update(). Hence
the call to update() will not result in the addition of a row to the
grid, even though you added the row to your model. Are you sure you are
not replacing the entire dataGrid in e.g. your getGrid() call?

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

  
nope, there is no magic in the getGrid() method. it only returns the 
grid. If I read the update() method
correctly I may even omit that call. So, the target.addComponent(grid) 
is sufficient
I'm using the inmethod-grid-1.4-rc7 with some extensions. wicket version 
is 1.4.6


--
Thierry Peng
  __  _
 / / /   / / / / /   GLUE Software Engineering AG
/ / __/ /   / / / / __/ Zieglerstr. 34, 3007 Bern,  Switzerland
/ /_/ / /___/ /_/ / /___Phone: +41-(0)31/385 30 34Fax: 30 18
\/_/\/_/___mailto: p...@glue.ch


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