• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERXDisplayGroup ---> ERXBatchingDisplayGroup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERXDisplayGroup ---> ERXBatchingDisplayGroup


  • Subject: Re: ERXDisplayGroup ---> ERXBatchingDisplayGroup
  • From: Ron X <email@hidden>
  • Date: Mon, 09 Apr 2012 12:06:43 +0300

but in such case in DirectAction i can not do common action.
so i will need to make every time action for the component in different context.
for example - i will use this ERXDirectActionBatchNavigationBar
for search pagination, main page pagination, user cart pagination.
so for 1 component i need 3 actions.
>> Organizations nextPage = (Organizations)pageWithName(
Organizations.class); - because this is not interface programming and i have hard bind to the Page-class.
because i can not get the component name (in DirectAction class) which was the context for action involved.


19 марта 2012 г. 18:32 пользователь Pascal Robert <email@hidden> написал:
I don't think mixing direct actions and REST will work fine.

> hi again.
>
> i noticed strange thing:
> when i used /ra/ (REST) and used AjaxUpdateComponent
> and used /wa/ with ERXDirectActionBatchNavigationBar
> when i go to the rest-links - Session Expires - everytime.
> how can i fix that?
>
> 19 марта 2012 г. 16:08 пользователь Ron X <email@hidden> написал:
> hi!
> so we have url:
> .woa/wa/entities?batch=5
>
> can i change "batch" to another word?
>
>
>
> 16 марта 2012 г. 15:16 пользователь Pascal Robert <email@hidden> написал:
>
>
> Le 2012-03-16 à 08:08, Ron X a écrit :
>
> > but how can i connect this component with datasource?
>
> dgOrganizations is a ERXBatchingDisplayGroup, so you just need to setup that display group.
>
>    public Organizations(WOContext context) {
>        super(context);
>        EODatabaseDataSource ds = new EODatabaseDataSource(ec, OrganizationProfile.ENTITY_NAME);
>        dgOrganizations = new ERXBatchingDisplayGroup<OrganizationProfile>();
>        dgOrganizations.setNumberOfObjectsPerBatch(10);
>        dgOrganizations.setDataSource(ds);
>        dgOrganizations.setSortOrderings(new NSArray<EOSortOrdering>(lastUpdateSort));
>   }
>
>    @Override
>    public void awake() {
>        super.awake();
>        isServiceFilter = false;
>        dgOrganizations.fetch();
>        queryArgs = new NSMutableDictionary<Object, String>();
>    }
>
>    public void setBatchIndex(int batchIndex) {
>        dgOrganizations.setCurrentBatchIndex(batchIndex);
>        queryArgs.takeValueForKey(batchIndex, "batch");
>    }
>
> The "organizations" direct action:
>
>  public WOActionResults organizationsAction() {
>    String strBatchIndex = this.request().stringFormValueForKey("batch");
>    Integer batchIndex = new Integer(1);
>    if (strBatchIndex != null) {
>      try {
>        batchIndex = new Integer(strBatchIndex);
>      } catch (Exception e) {
>        NSLog.out.appendln("Someone tried to access a batch index with this value : " + strBatchIndex);
>      }
>    }
>    Organizations nextPage = (Organizations)pageWithName(Organizations.class);
>    nextPage.setBatchIndex(batchIndex.intValue());
>    return nextPage;
>  }
>
> > 2012/3/13 Pascal Robert <email@hidden>
> > Use ERXDirectActionBatchNavigationBar
> >
> > <wo:ERXDirectActionBatchNavigationBar
> >        actionName = "organizations"
> >        containerCssClass = "paginator"
> >        batchSize = "$dgOrganizations.batchCount"
> >        currentBatchIndex = "$dgOrganizations.currentBatchIndex"
> >        showPageNumbers = true
> >        numberOfObjects = "$dgOrganizations.allObjects.@count"
> > />
> >
> > Please note that it will use Direct Actions, so it won't work with REST routes. I'm planning to do a similar component for REST because I need it for wocommunity.org, but I won't work on this before end of this month.
> >
> > > sorry, maybe i explain bad.
> > >
> > > "so the workflow is so" - that is how it works NOW.
> > > but i want to fetching objects at every click of the page and do not changing the url (or have control of changing).
> > >
> > > 2012/3/13 Pascal Robert <email@hidden>
> > >    EODatabaseDataSource dataSource = new EODatabaseDataSource(editingContext(), Category.ENTITY_NAME);
> > >    er.extensions.batching.ERXBatchingDisplayGroup dg = new ERXBatchingDisplayGroup<Category>();
> > >    dg.setNumberOfObjectsPerBatch(20);
> > >    dg.setDataSource(dataSource);
> > >    dg.setObjectArray(Category.fetchAllCategories(editingContext()));
> > >
> > > > hi everybody.
> > > > i have some legasy code.
> > > > in this code used ERXDisplayGroup:
> > > >
> > > > //code:
> > > > import com.webobjects.appserver.WOContext;
> > > > import com.webobjects.appserver.WODisplayGroup;
> > > > import com.webobjects.directtoweb.ERD2WUtilities;
> > > >
> > > > import er.directtoweb.pages.ERD2WListPage;
> > > > import er.extensions.batching.ERXBatchingDisplayGroup;
> > > > import er.extensions.batching.ERXFlickrBatchNavigation;
> > > >
> > > > public class BatchNavigationBar extends ERXFlickrBatchNavigation {
> > > >     public BatchNavigationBar(WOContext context) {
> > > >         super(context);
> > > >     }
> > > >
> > > >     private ERD2WListPage listPage() {
> > > >         return (ERD2WListPage) ERD2WUtilities.enclosingPageOfClass(this, ERD2WListPage.class);
> > > >     }
> > > >
> > > >     @Override
> > > >     public WODisplayGroup displayGroup() {
> > > >         return listPage().displayGroup();
> > > >     }
> > > >
> > > >     public void setCurrentBatchIndex(Integer batchIndex) {
> > > >         displayGroup().setCurrentBatchIndex(batchIndex);
> > > >     }
> > > > }
> > > > //end code
> > > >
> > > > so the workflow is so:
> > > >
> > > > 1. fetching ALL object of query in array.
> > > > 2. and than give me a portion (size if batch) when i am clicking next/prev pages in this component.
> > > > 3. but NO work with database per batch - it works with array
> > > > 4. when i click next/prev - it adds to the urls of pagination some like this - 1.2.3.1.5.6.7 etc :-) and this brakes my statistics with SEO links.
> > > >
> > > > so i want to avoid this. and i want to use ERXBatchingDisplayGroup instead of WODisplayGroup (ERXDisplayGroup).
> > > > Simple casting not works - falls with cast exception.
> > > > the problem in that listPage().displayGroup() - has type WODisplayGroup.
> > > >
> > > > how can i use in this code ERXBatchingDisplayGroup?
> > > >
> > > > _______________________________________________
> > > > Do not post admin requests to the list. They will be ignored.
> > > > Webobjects-dev mailing list      (email@hidden)
> > > > Help/Unsubscribe/Update your Subscription:
> > > >
> > > > This email sent to email@hidden
> > >
> > >
> >
> >
>
>
>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: [ANN] WOInject 1.0
  • Next by Date: Quick Question about ListExcel*
  • Previous by thread: Re: New Framework on the way
  • Next by thread: Quick Question about ListExcel*
  • Index(es):
    • Date
    • Thread