Re: [Wonder-disc] ERXDisplayGroup setQualifier behaviour

2013-02-03 Thread Amedeo Mantica
Hi,…ciao :-) Daniele

there is something that set null to _displayGroup after the page render ?

Seems like that when u click on the link the displayGroup() method is called 
again and resets the _displayGroup array (is something had set it to null).
Put a braakpoint there and check.

Amedeo

On 28/gen/2013, at 16:39, Daniele Corti ilde...@gmail.com wrote:

 Hi everyone, 
 my app is doing something of strange, and I don't understand what it's wrong 
 with my code.
 
 I've some Entities that I've to display in a table, so I use the 
 ERXDisplayGroup class.
 
 Here an example:
 
 public ERXDisplayGroupCollaborator displayGroup() {
 
 // IF Null instantiate it
 if(_displayGroup == null){
   _displayGroup = new ERXDisplayGroupCollaborator();
 
   EOArrayDataSource dataSource = new 
 EOArrayDataSource(EOClassDescription.classDescriptionForEntityName(Collaborator.ENTITY_NAME),
  editingContext());
 
   //Check user is logged in
   if(session().hasUserLogged()){
//Check if user has chose the company
if(session().hasChoosedCompany()){
  
 dataSource.setArray(Collaborator.fetchCollaboratorsForCompany(editingContext(),
  session().company()));
}
  }
   _displayGroup.setDataSource(dataSource);
   _displayGroup.setCurrentBatchIndex(1);

 _displayGroup.setNumberOfObjectsPerBatch(NUMBER_OF_OBJECTS_PER_BATCH);
   _displayGroup.fetch();
 }
 return _displayGroup;
 }
 
 this method is called as binding in the loop component:
 wo:loop list = $displayGroup.displayedObjects item = $object
 
 and the object binding is simply a variable of the component.
 private Collaborator object;
 //With public getter and setter
 
 on each row I've a link that call:
 
 public WOActionResults selectObj() {
   this.parent().takeValueForKey(object, selectedCollaborator);
   return performParentAction(selectCollaborator);
 }
 
 Ok, I'm able to filter the list using the setQualifier method of the 
 DisplayGroup:
 
 public void setQualifier(EOQualifier qualifier){
 displayGroup().setQualifier(qualifier);
 displayGroup().fetch();
 }
 
 public EOQualifier qualifier() {
 return null;
 }
 
 I call the list component passing the qualifier binding in the parent 
 componet:
 
 wo:CollaboratorsList qualifier = $qualifier/wo:CollaboratorsList
 
 When I pass a qualifier the page show the filtered list correctly. 
 
 The problem is: when I click on the link with action = $selectObj of the, 
 for example, 2nd object of filtered list, the object variable in the class 
 does not contain the instance related to the selected row, but the instance 
 in the second position of the full list of objects in the displayGroup.
 
 Example:
 
 a table with:
 
 ---
 | link | Mario Rossi | The Address 1 | His City |
 ---
 | link | John Smith | The Address 2 |  City2 |
 ---
 | link | Francis Cabret | The Address| His City |
 ---
 
 ---
 
 I filter the list for name LIKE *John Smit* and get only one row.
 
 ---
 | link | John Smith | The Address 2 |  City2 |
 ---
 
 but when I click on the link, in the action selectObj(), the object variable 
 contains the instance for Mario Rossi. 
 
 That's strange for me...
 
 I thought this should have work, but, evidently, is not so!
 
 Which is the correct way to use the ERXDisplayGroup.setQualifier method?
 
 Thanks in advance!
 -- 
 Daniele Corti
 --
 I DON'T DoubleClick
 --
 Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
 MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
 with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
 MVPs and experts. ON SALE this month only -- learn more at:
 http://p.sf.net/sfu/learnnow-d2d___
 Wonder-disc mailing list
 wonder-d...@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wonder-disc

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ERXDisplayGroup setQualifier behaviour

2013-01-28 Thread Daniele Corti
Hi everyone,
my app is doing something of strange, and I don't understand what it's
wrong with my code.

I've some Entities that I've to display in a table, so I use the
ERXDisplayGroup class.

Here an example:

public ERXDisplayGroupCollaborator displayGroup() {

// IF Null instantiate it
if(_displayGroup == null){
  _displayGroup = new ERXDisplayGroupCollaborator();

  EOArrayDataSource dataSource = new
EOArrayDataSource(EOClassDescription.classDescriptionForEntityName(Collaborator.ENTITY_NAME),
editingContext());

  //Check user is logged in
  if(session().hasUserLogged()){
   //Check if user has chose the company
   if(session().hasChoosedCompany()){

 dataSource.setArray(Collaborator.fetchCollaboratorsForCompany(editingContext(),
session().company()));
   }
 }
  _displayGroup.setDataSource(dataSource);
  _displayGroup.setCurrentBatchIndex(1);

 _displayGroup.setNumberOfObjectsPerBatch(NUMBER_OF_OBJECTS_PER_BATCH);
  _displayGroup.fetch();
}
return _displayGroup;
}

this method is called as binding in the loop component:
wo:loop list = $displayGroup.displayedObjects item = $object

and the object binding is simply a variable of the component.
private Collaborator object;
//With public getter and setter

on each row I've a link that call:

public WOActionResults selectObj() {
  this.parent().takeValueForKey(object, selectedCollaborator);
  return performParentAction(selectCollaborator);
}

Ok, I'm able to filter the list using the setQualifier method of the
DisplayGroup:

public void setQualifier(EOQualifier qualifier){
displayGroup().setQualifier(qualifier);
displayGroup().fetch();
}

public EOQualifier qualifier() {
return null;
}

I call the list component passing the qualifier binding in the parent
componet:

wo:CollaboratorsList qualifier = $qualifier/wo:CollaboratorsList

When I pass a qualifier the page show the filtered list correctly.

The problem is: when I click on the link with action = $selectObj of the,
for example, 2nd object of filtered list, the object variable in the class
does not contain the instance related to the selected row, but the instance
in the second position of the full list of objects in the displayGroup.

Example:

a table with:

---
| link | Mario Rossi | The Address 1 | His City |
---
| link | John Smith | The Address 2 |  City2 |
---
| link | Francis Cabret | The Address| His City |
---

---

I filter the list for name LIKE *John Smit* and get only one row.

---
| link | John Smith | The Address 2 |  City2 |
---

but when I click on the link, in the action selectObj(), the object
variable contains the instance for Mario Rossi.

That's strange for me...

I thought this should have work, but, evidently, is not so!

Which is the correct way to use the ERXDisplayGroup.setQualifier method?

Thanks in advance!
-- 
Daniele Corti
--
I DON'T DoubleClick
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com