Re: Refreshing a List view

2008-06-06 Thread Maurice Marrink
If that does not work you can also force the list to recreate all
items by calling removeAll() after you have  deleted the object.

Maurice

On Thu, Jun 5, 2008 at 7:39 PM, Sam Barnum [EMAIL PROTECTED] wrote:
 Ricky, what are you using as the model for your refreshing view?

 You should be using some sort of detachable model that re-fetches the items
 for the list from the DB each time.

 --
 Sam Barnum
 360 Works
 http://www.360works.com
 415.865.0952



 On Jun 5, 2008, at 10:32 AM, Ricky wrote:

 Hi,

 I have a RefreshingView which has a delete button in it (this deletes the
 model present in the backing list for the view.) The problem is that when
 a
 delete is performed on DB, (see onSubmit( ) for
 *deletePlanObjectiveDetailButton
 below)  *the size of the list changes, Is there a way to refresh the
 view
 after I remove the model from the backing list (list.remove( xxx )) ??
 Here's a snippet of what i am doing:

 *new RefreshingView(refreshing-view-list) {

// populate item.
protected final void populateItem(final Item item) {
final MODEL backingListModel = (backingListModel)
 item.getModelObject();

 item.add(new Label(label-objective-name,
 backingListModel.getName()));

final Button deletePlanObjectiveDetailButton = new
 Button(button-delete-plan-objective-details) {
private static final long serialVersionUID = 1L;

// onSubmit.
public final void onSubmit() {
new
 ObjectiveMeasureDataProvider().deleteObjectiveMeasure(backingListModel);
backingListModels.remove(  );  ///  Searches
 for backing Model deleted in current list based on id and removes it.
// TODO Figure out a way to do list view refresh
 here.
  }
};
  item.add(deletePlanObjectiveDetailButton);
}
};

 *Any Help would be appreciable!!???*
 *Rick



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refreshing a List view

2008-06-06 Thread Ricky
Thanks for the help guys, but still cannot make it to work =(

Rick

On Fri, Jun 6, 2008 at 3:22 AM, Maurice Marrink [EMAIL PROTECTED] wrote:

 If that does not work you can also force the list to recreate all
 items by calling removeAll() after you have  deleted the object.

 Maurice

 On Thu, Jun 5, 2008 at 7:39 PM, Sam Barnum [EMAIL PROTECTED] wrote:
  Ricky, what are you using as the model for your refreshing view?
 
  You should be using some sort of detachable model that re-fetches the
 items
  for the list from the DB each time.
 
  --
  Sam Barnum
  360 Works
  http://www.360works.com
  415.865.0952
 
 
 
  On Jun 5, 2008, at 10:32 AM, Ricky wrote:
 
  Hi,
 
  I have a RefreshingView which has a delete button in it (this deletes
 the
  model present in the backing list for the view.) The problem is that
 when
  a
  delete is performed on DB, (see onSubmit( ) for
  *deletePlanObjectiveDetailButton
  below)  *the size of the list changes, Is there a way to refresh the
  view
  after I remove the model from the backing list (list.remove( xxx )) ??
  Here's a snippet of what i am doing:
 
  *new RefreshingView(refreshing-view-list) {
 
 // populate item.
 protected final void populateItem(final Item item) {
 final MODEL backingListModel = (backingListModel)
  item.getModelObject();
 
  item.add(new Label(label-objective-name,
  backingListModel.getName()));
 
 final Button deletePlanObjectiveDetailButton = new
  Button(button-delete-plan-objective-details) {
 private static final long serialVersionUID = 1L;
 
 // onSubmit.
 public final void onSubmit() {
 new
  ObjectiveMeasureDataProvider().deleteObjectiveMeasure(backingListModel);
 backingListModels.remove(  );  ///  Searches
  for backing Model deleted in current list based on id and removes it.
 // TODO Figure out a way to do list view refresh
  here.
   }
 };
   item.add(deletePlanObjectiveDetailButton);
 }
 };
 
  *Any Help would be appreciable!!???*
  *Rick
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Refreshing a List view

2008-06-06 Thread Ricky
Hey Guys,

FYI - instead of a simple button i created an AJAX link and then marked all
the components in the panel (which encloses the refreshing view) to true
(setOutputMarkupId(true)), and basically it refreshes just the view if a
delete happens. So its working now . Here's the simplified code for the
delete button:

final AjaxLink deletePlanObjectiveDetailButton = new
AjaxLink(button-delete-plan-objective-details) {

 public final void onClick(AjaxRequestTarget target) {
// Step 1 : Delete from DB, removed for clarity.

*// REMOVE THE ITEM from the list*
 modelList.remove( item.getIndex( ) );

// *Set the refreshing view model as a list.*
this.getParent().setModel(new
CompoundPropertyModel((Serializable) revPlanObjDetails));

// refreshing view cannot be a direct target for
AJAX updates, so we have to use
// next parent which is NOT  refreshing  view.

target.addComponent(this.getParent().getParent().getParent());
}
};

Once again, Thanks for your help guys.
Rick
On Fri, Jun 6, 2008 at 11:27 AM, Ricky [EMAIL PROTECTED] wrote:

 Thanks for the help guys, but still cannot make it to work =(

 Rick


 On Fri, Jun 6, 2008 at 3:22 AM, Maurice Marrink [EMAIL PROTECTED] wrote:

 If that does not work you can also force the list to recreate all
 items by calling removeAll() after you have  deleted the object.

 Maurice

 On Thu, Jun 5, 2008 at 7:39 PM, Sam Barnum [EMAIL PROTECTED] wrote:
  Ricky, what are you using as the model for your refreshing view?
 
  You should be using some sort of detachable model that re-fetches the
 items
  for the list from the DB each time.
 
  --
  Sam Barnum
  360 Works
  http://www.360works.com
  415.865.0952
 
 
 
  On Jun 5, 2008, at 10:32 AM, Ricky wrote:
 
  Hi,
 
  I have a RefreshingView which has a delete button in it (this deletes
 the
  model present in the backing list for the view.) The problem is that
 when
  a
  delete is performed on DB, (see onSubmit( ) for
  *deletePlanObjectiveDetailButton
  below)  *the size of the list changes, Is there a way to refresh the
  view
  after I remove the model from the backing list (list.remove( xxx )) ??
  Here's a snippet of what i am doing:
 
  *new RefreshingView(refreshing-view-list) {
 
 // populate item.
 protected final void populateItem(final Item item) {
 final MODEL backingListModel = (backingListModel)
  item.getModelObject();
 
  item.add(new Label(label-objective-name,
  backingListModel.getName()));
 
 final Button deletePlanObjectiveDetailButton = new
  Button(button-delete-plan-objective-details) {
 private static final long serialVersionUID = 1L;
 
 // onSubmit.
 public final void onSubmit() {
 new
 
 ObjectiveMeasureDataProvider().deleteObjectiveMeasure(backingListModel);
 backingListModels.remove(  );  /// 
 Searches
  for backing Model deleted in current list based on id and removes it.
 // TODO Figure out a way to do list view refresh
  here.
   }
 };
   item.add(deletePlanObjectiveDetailButton);
 }
 };
 
  *Any Help would be appreciable!!???*
  *Rick
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Refreshing a List view

2008-06-05 Thread Sam Barnum

Ricky, what are you using as the model for your refreshing view?

You should be using some sort of detachable model that re-fetches the  
items for the list from the DB each time.


--
Sam Barnum
360 Works
http://www.360works.com
415.865.0952



On Jun 5, 2008, at 10:32 AM, Ricky wrote:


Hi,

I have a RefreshingView which has a delete button in it (this  
deletes the
model present in the backing list for the view.) The problem is  
that when a

delete is performed on DB, (see onSubmit( ) for
*deletePlanObjectiveDetailButton
below)  *the size of the list changes, Is there a way to refresh  
the view

after I remove the model from the backing list (list.remove( xxx )) ??
Here's a snippet of what i am doing:

*new RefreshingView(refreshing-view-list) {

// populate item.
protected final void populateItem(final Item item) {
final MODEL backingListModel = (backingListModel)
item.getModelObject();

 item.add(new Label(label-objective-name,
backingListModel.getName()));

final Button deletePlanObjectiveDetailButton = new
Button(button-delete-plan-objective-details) {
private static final long serialVersionUID = 1L;

// onSubmit.
public final void onSubmit() {
new
ObjectiveMeasureDataProvider().deleteObjectiveMeasure 
(backingListModel);
backingListModels.remove(  );  ///   
Searches

for backing Model deleted in current list based on id and removes it.
// TODO Figure out a way to do list view  
refresh

here.
  }
};
  item.add(deletePlanObjectiveDetailButton);
}
};

*Any Help would be appreciable!!???*
*Rick