You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "N. Metzger" <nm...@odu.edu> on 2012/12/13 15:16:06 UTC
AjaxEditableLabel not saving after migration to 6.3
Hi all,
I recently migrated from 1.5.5 to 6.3. My objective is to display a list of
group members with the ability to insert or update an expiration date for a
specific member. It worked correctly before, but now I'm having problems
with my AjaxEditableLabel nested in a PropertyColumn. I can click the label
and type something, but on hitting enter, nothing changes and the onSubmit()
is never called. As I said, it worked in 1.5.
Below is a code excerpt.
Any pointers would be appreciated,
Natalie
private class PersonTabPanel extends Panel
{
public PersonTabPanel(String id){
super(id);
AjaxFallbackDefaultDataTable dataTable = new
AjaxFallbackDefaultDataTable("memberTable", definePersonColumns(),
new MemberDataProvider(currentGroup,
"MEMBER", "PERSON"), ELEMENTS_PER_PAGE);
dataTable.setItemReuseStrategy(new
DefaultItemReuseStrategy());
add(dataTable);
}
}
public List<IColumn<MemberInterface, Object>> definePersonColumns(){
List<IColumn<MemberInterface, Object>> columns = new
ArrayList<IColumn<MemberInterface, Object>>();
columns.add(new PropertyColumn<MemberInterface, Object>(new
Model<String>("Last Name"), "lastname", "lastname"));
columns.add(new PropertyColumn<MemberInterface, Object>(new
Model<String>("First Name"), "displayedFirstName", "displayedFirstName"));
columns.add(new PropertyColumn<MemberInterface, Object>(new
Model<String>("Email Address"), "emailAddress", "emailAddress"));
if (isMemberEditAuthorized(currentGroup.getGroupCode()) ){
columns.add(new PropertyColumn<MemberInterface, Object>(new
Model<String>("Expiration (MM/DD/YY)"), "expirationDate", "expirationDate")
{
@Override
public void
populateItem(Item<ICellPopulator<MemberInterface>> cellItem, String
componentId,
final IModel<MemberInterface>
rowModel)
{
AjaxEditableLabel<Date> editableLabel = new
AjaxEditableLabel<Date>(componentId,
new
PropertyModel<Date>(rowModel, "expirationDate")){
@Override
protected void onSubmit(AjaxRequestTarget target){
int groupCode = currentGroup.getGroupCode();
Date expiration = (Date)
getDefaultModelObject();
if (expiration != null)
expiration = new Date(expiration.getTime() +
86399000L); //expires at 23:59:59 on the given date
MemberInterface selectedMember =
(MemberInterface) rowModel.getObject();
int gidm = selectedMember.getGidm();
String memberType =
selectedMember.getMemberType();
try {
expireMember(sessionId, midm, groupCode,
gidm, memberType, expiration);
logger.debug("{}:{}: Set a member expiration
date to "+
expiration+" for GIDM " +gidm,
sessionId, midm);
} catch (Exception e) {
logger.error("Caught an exception while
updating a group member expiration", e);
error("An error occurred while updating the
expiration date.");
}
getLabel().setVisible(true);
getEditor().setVisible(false);
target.add(this);
target.appendJavaScript("window.status='';");
target.add(feedback);
}
@Override
protected String defaultNullLabel(){
return ("[click to edit]");
}
@Override
protected void onError(AjaxRequestTarget target){
target.add(feedback);
}
};
cellItem.add(editableLabel);
}
});
[Rest of code omitted]
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxEditableLabel-not-saving-after-migration-to-6-3-tp4654769.html
Sent from the Users forum 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: AjaxEditableLabel not saving after migration to 6.3
Posted by "N. Metzger" <nm...@odu.edu>.
I believe this is a bug in wicket 6.3, because I switched to wicket 6.4 and
it miraculously works again without code changes on my side.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxEditableLabel-not-saving-after-migration-to-6-3-tp4654769p4655314.html
Sent from the Users forum 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: AjaxEditableLabel not saving after migration to 6.3
Posted by "N. Metzger" <nm...@odu.edu>.
Could it be a problem that I try set set a date field?
To answer your questions:
1) Nothing happens onBlur.
2) The first AEL in the wicket-examples works in firefox, the second shows
an internal error in the wicket-ajax-debug window
3) I'm not an expert in firebug, but it seems to have made an Ajax call that
ended in a return statement which seems to have ended the ajax call
/*!
* jQuery JavaScript Library v1.8.2
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time)
*/
line 2680:
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !==
e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE
non-native events
eventHandle.elem = elem;
}
4) Below is what wickat-ajax-debug says:
INFO: focus set on editor60b from serverside
INFO: Response processed successfully.
INFO: Calling focus on editor60b
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Ajax request stopped because of precondition check, url:
../../../fyBfZ9p6trPElfM8YdeMMUap7i3XT-GH1hfW-wiOyrOys3JrRBsnLgzUVGIEbaCNSbPbWSdyM0gV7Cro1eR5Go-8aioXxK9ltyqjXsu91ivAL76ObByWEe4hYc0_LFEHou5Mg-JkExU4UXwSxBr76YdkWn-H9qpH5e6Z14uBwbvR2KIf4K7M-Q/fyBce/9lt50
INFO: Received ajax response (2087 characters)
INFO:
<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="cell609"
encoding="wicket1" ></component><header-contribution encoding="wicket1"
></header-contribution><evaluate></evaluate></ajax-response>
INFO: returned focused element: [object HTMLInputElement]
INFO: returned focused element: null
INFO: Response processed successfully.
INFO: refocus last focused component not needed/allowed
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxEditableLabel-not-saving-after-migration-to-6-3-tp4654769p4654775.html
Sent from the Users forum 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: AjaxEditableLabel not saving after migration to 6.3
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
By default AEL submits on ENTER key press or blur event. Does it work with
blur ?
Check with Firebug or similar whether an Ajax call is made at all.
Check whether
http://www.wicket-library.com/wicket-examples-6.0.x/ajax/editable-label<http://www.wicket-library.com/wicket-examples-6.0.x/ajax/editable-label?0>
works
with your browser.
On Thu, Dec 13, 2012 at 4:16 PM, N. Metzger <nm...@odu.edu> wrote:
> Hi all,
>
> I recently migrated from 1.5.5 to 6.3. My objective is to display a list of
> group members with the ability to insert or update an expiration date for a
> specific member. It worked correctly before, but now I'm having problems
> with my AjaxEditableLabel nested in a PropertyColumn. I can click the label
> and type something, but on hitting enter, nothing changes and the
> onSubmit()
> is never called. As I said, it worked in 1.5.
>
> Below is a code excerpt.
>
> Any pointers would be appreciated,
> Natalie
>
>
> private class PersonTabPanel extends Panel
> {
> public PersonTabPanel(String id){
> super(id);
>
> AjaxFallbackDefaultDataTable dataTable = new
> AjaxFallbackDefaultDataTable("memberTable", definePersonColumns(),
> new
> MemberDataProvider(currentGroup,
> "MEMBER", "PERSON"), ELEMENTS_PER_PAGE);
> dataTable.setItemReuseStrategy(new
> DefaultItemReuseStrategy());
> add(dataTable);
> }
> }
>
> public List<IColumn<MemberInterface, Object>> definePersonColumns(){
> List<IColumn<MemberInterface, Object>> columns = new
> ArrayList<IColumn<MemberInterface, Object>>();
>
> columns.add(new PropertyColumn<MemberInterface, Object>(new
> Model<String>("Last Name"), "lastname", "lastname"));
> columns.add(new PropertyColumn<MemberInterface, Object>(new
> Model<String>("First Name"), "displayedFirstName", "displayedFirstName"));
> columns.add(new PropertyColumn<MemberInterface, Object>(new
> Model<String>("Email Address"), "emailAddress", "emailAddress"));
>
> if (isMemberEditAuthorized(currentGroup.getGroupCode()) ){
>
> columns.add(new PropertyColumn<MemberInterface, Object>(new
> Model<String>("Expiration (MM/DD/YY)"), "expirationDate", "expirationDate")
> {
> @Override
> public void
> populateItem(Item<ICellPopulator<MemberInterface>> cellItem, String
> componentId,
> final IModel<MemberInterface>
> rowModel)
> {
> AjaxEditableLabel<Date> editableLabel = new
> AjaxEditableLabel<Date>(componentId,
> new
> PropertyModel<Date>(rowModel, "expirationDate")){
> @Override
> protected void onSubmit(AjaxRequestTarget target){
> int groupCode = currentGroup.getGroupCode();
> Date expiration = (Date)
> getDefaultModelObject();
> if (expiration != null)
> expiration = new Date(expiration.getTime()
> +
> 86399000L); //expires at 23:59:59 on the given date
>
> MemberInterface selectedMember =
> (MemberInterface) rowModel.getObject();
> int gidm = selectedMember.getGidm();
> String memberType =
> selectedMember.getMemberType();
>
> try {
> expireMember(sessionId, midm, groupCode,
> gidm, memberType, expiration);
> logger.debug("{}:{}: Set a member
> expiration
> date to "+
> expiration+" for GIDM " +gidm,
> sessionId, midm);
> } catch (Exception e) {
> logger.error("Caught an exception while
> updating a group member expiration", e);
> error("An error occurred while updating the
> expiration date.");
> }
>
> getLabel().setVisible(true);
> getEditor().setVisible(false);
> target.add(this);
> target.appendJavaScript("window.status='';");
> target.add(feedback);
> }
>
> @Override
> protected String defaultNullLabel(){
> return ("[click to edit]");
> }
>
> @Override
> protected void onError(AjaxRequestTarget target){
>
> target.add(feedback);
> }
> };
> cellItem.add(editableLabel);
> }
> });
>
> [Rest of code omitted]
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AjaxEditableLabel-not-saving-after-migration-to-6-3-tp4654769.html
> Sent from the Users forum 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
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>