myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek" <martin.marinsc...@gmail.com>
Subject Re: Custom DataScroller (t:dataScroller)
Date Fri, 08 Feb 2008 00:31:51 GMT
Hi Tathagat,

<h:dataTable value="#{bean.dataModel}"/>

Bean

{
   public DataModel getDataModel();
}

Like this, you can wrap the corresponding list in a DataModel and do
more than just extract data - DataModel is a powerful interface. As
for concrete implementations, DataModel can be of type ListDataModel,
e.g. Is this what you want? I still don't understand what you mean by
getting the data - the data is in the value, so you can call
getValue() on the component, and this is not protected. Do you need
anything more?

regards,

Martin

On Feb 7, 2008 4:59 PM, Tathagat <mail@tathagat.com> wrote:
> Hi again Martin.
>
> I want to access the data from my custom dataScroller Renderer Class.
> public class MaeHtmlDataScrollerRenderer extends HtmlDataScrollerRenderer
>
> This means even if I use the binding property for dataTable, I am stuck.
> Cause of the protected methods I cannot get the data out.
>
> What do you mean by set the value to a data-model? As in a new property to
> the custom dataScroller?
>
> Thanks again
> Tathagat
>
>
>
> On 2/7/08, Martin Marinschek <martin.marinschek@gmail.com> wrote:
> > Hi Tathagat,
> >
> > you could bind the <h:dataTable/> with the binding attribute to a
> > backing-bean - or you could set the value to a data-model, then you
> > have access to the full data-model.
> >
> > regards,
> >
> > Martin
> >
> > On 2/7/08, Tathagat <mail@tathagat.com> wrote:
> > > Hi Martin.
> > > Let me re-word my question.
> > >
> > > I need all the data associated with a dataTable in my java code to do
> some
> > > stuff with it. If you somehow get hold of this dataTable object - it's
> not
> > > possible to get data out of it as all such methods are protected.
> > > BUT a dataScroller has a method - getUIData() - which gives the data on
> the
> > > "active" page.
> > > So if I associate a dummy scroller with our dataTable (also dummy - copy
> of
> > > original with rows=all data) (but hide it) having just 1 page, I have
> access
> > > to all data in dataTable (indirectly using dataScroller). This is the
> hack I
> > > was talking about.
> > >
> > > Is it clearer?
> > >
> > > I wanna know if there is a better way to get all data associated with
> the
> > > table on java level?
> > >
> > > Why I wanna do this - or where am I headed - to get a custom scroller.
> > >
> > > Current data scroller gives a paginator in the following format:
> > > 1-100, 101-200, 201-300.. and so on.
> > >
> > > What I would like is value of a column (along which the table is
> sorted),
> > > for example:
> > > AAA-CAT, CAU-FAX, FBC-MPC... and so on.
> > > The advantage is that user sees immediately where the value lies in the
> > > paginator (and does not have to guess).
> > >
> > > To do this.. I need all the data in the dataTable on java level.
> > >
> > > Hope I was clearer????
> > >
> > > Thanks for your time.
> > > Tathagat
> > >
> > >
> > > On 2/6/08, Martin Marinschek <martin.marinschek@gmail.com> wrote:
> > > >
> > > > Hi Tathagat,
> > > >
> > > > I am very sorry, but I do not understand where you are heading. Why
> should
> > > > the second scroller have all data then? I really don't get your
> > > explanation.
> > > >
> > > > regards,
> > > >
> > > > Martin
> > > >
> > > > On Feb 1, 2008 4:18 PM, Tathagat <mail@tathagat.com> wrote:
> > > >
> > > > > Hi All.
> > > > > Current data scroller gives a paginator in the following format:
> > > > > 1-100, 101-200, 201-300.. and so on.
> > > > >
> > > > > What I would like is value of a column (along which the table is
> > > > > sorted), for example:
> > > > > AAA-CAT, CAU-FAX, FBC-MPC... and so on.
> > > > > The advantage is that user sees immediately where the value lies
in
> the
> > > > > paginator (and does not have to guess).
> > > > >
> > > > > I implemented my own solution for it.
> > > > > Extended t:dataScroller classes with my own (regsitering
> faces-config,
> > > > > new taglib, entry in web.xml).
> > > > > I had to override the following method in
> > > > > org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer
> > > > > protected HtmlCommandLink getLink(FacesContext facesContext,
> > > > > HtmlDataScroller scroller,
> > > > >             String text, int pageIndex)
> > > > >
> > > > > Now the problem here was to get the data of the table mentioned in
> "for"
> > > > > property of datascroller.
> > > > > By default dataScroller has only "rows" (property of t:dataTable)
> amount
> > > > > of data (which is currently visible to user).
> > > > > --scroller.getUIData()
> > > > >
> > > > > So I used the following hack.
> > > > > Define the same scroller and table with different IDs with
> rows=total
> > > > > number of rows and style=display:none;
> > > > > Causing it not to show on the page but having the second sroller
all
> the
> > > > > data in it.
> > > > >
> > > > > Thus I could build a paginator as mentioned above.
> > > > >
> > > > > My questions is:
> > > > > Is there a better way to get all the data in the table? All methods
> > > > > which provide data are protected.
> > > > >
> > > > > Thanks for your time.
> > > > > Tathagat
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > >
> > > > http://www.irian.at
> > > >
> > > > Your JSF powerhouse -
> > > > JSF Consulting, Development and
> > > > Courses in English and German
> > > >
> > > > Professional Support for Apache MyFaces
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>
>



-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message