You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by "Gorbas, Paul H [IT]" <Pa...@sprint.com> on 2007/11/13 20:47:08 UTC

How to add default text to datagrid

Sorry, I am grasping at straws here to come up with what *should* be a
simple solution to a common issue, but I can find a tech reference which
covers this area.

When you are using the netui:datagrid control, how do you set the
default message which displays when the data set is null or empty?

So if a DataGrid with data displays like this:
*	HEDADER
*	<repeat start>
*		data rows....
*	<repeat end>
*	FOOTER


That is instead of my empty datagrid just displaying:
*	HEDADER
*	FOOTER

It would instead displays something like:
*	HEDADER
*		No data to be displayed.
*	FOOTER

I would like to avoid having to implement a custom pager class to
provide this basic functionality.

Thanks in advance.  If there is a link to a resource I do not know about
for this type of information I would also appreciate getting it.
-Paul Gorbas





Re: How to add default text to datagrid

Posted by Eddie O'Neil <ek...@gmail.com>.
  Not to confuse this issue even more, but I had a copy / paste error
in that last mail.  The code to disable default pager rendering:

  <netui-data:configurePager disableDefaultPager="false"/>

should have been:

  <netui-data:configurePager disableDefaultPager="true"/>

  My apologies!

Eddie


On Nov 20, 2007 10:18 AM, Eddie O'Neil <ek...@gmail.com> wrote:
> Paul--
>
>   If I'm understanding your question correctly, you're just trying to
> get _some_ message displayed that says that there's no data.  Correct?
>
>   Assuming that, the "no data" message is rendered by the data grid's
> pager which is responsible for displaying status information about the
> size of the data set.  In order for this to work, however, the pager
> must render either:
>
> - Automatically.  By default, the pager renders before the opening
> <table> tag.  If the data set is empty, this is where the "no data"
> message would appear.
> - Manually.  In order to precisely control the location of the pager,
> automatic rendering is disabled by setting
>
>     <netui-data:configurePager disableDefaultPager="false"/>
>
> In this case, the <netui-data:renderPager/> tag must be used to render
> the pager somewhere inside the body of the <dataGrid> tag.
>
>   Back to the original question about changing the message, there are
> a variety of ways to do this; the simplest is to add this to the body
> of the <dataGrid> tag:
>
>     <netui:behavior facet="resource" name="datagrid.msg.nodata"
> value="Nothing to see here."/>
>
> This will change the behavior of the data grid by setting a new
> message to display when there's no data.  If you need full i18n
> capability, take a look at the <dataGrid>'s resourceBundlePath
> attribute, which supports creating .properties files for all messages
> rendered by the grid.
>
>   Hope that helps.
>
> Eddie
>
>
>
>
> On Nov 13, 2007 4:28 PM, Carlin Rogers <ca...@gmail.com> wrote:
> > Hi Paul,
> >
> > Sorry, I thought you were trying to change or remove the message. The
> > actual String that is rendered from the default noDataRender() method
> > is very close to what you had in your email, "No data to display".
> >
> > Do you have a simple repro or a fragment of the JSP you can share?
> > Maybe someone on the list will be able to identify why the data grid
> > in your page has a null body.
> >
> > Carlin
> >
> > On 11/13/07, Gorbas, Paul H [IT] <Pa...@sprint.com> wrote:
> >
> > > Thanks for the suggestions Carlin, I will follow up on them.
> > >
> > > One thing I should point out is I don't particularly care about the
> > > exact content of the "no data" message is, my code is not displaying
> > > anything (That is I get a header and footer but null body) - so that
> > > default behavior you mentioned of the noDataRender() method for some
> > > reason not working in my code ( Or it is working, but it is displaying a
> > > null or empty string. )
> > >
> > >
> > > -Paul G.
> > >
> > > -----Original Message-----
> > > From: Carlin Rogers [mailto:carlin.rogers@gmail.com]
> > > Sent: Tuesday, November 13, 2007 2:50 PM
> > > To: Beehive Users
> > > Subject: Re: How to add default text to datagrid
> > >
> > > Hi Paul,
> > >
> > > One possible solution would be to use JSTL and test the data size.
> > > Between the header and footer you could put your markup within the
> > > following tags...
> > >
> > >     <c:if test="${dataGrid.dataSet.size > 0}">
> > >         ...
> > >     </c:if>
> > >
> > >
> > > Otherwise, I think it would have to be a custom pager that is configured
> > > using...
> > >
> > >     <netui-data:configurePager pagerRendererClass="com.you.className"
> > > ...>
> > >
> > > Looking at the implementation of the NetUI datagrid class,
> > > PagerRenderer, it's noDataRender() method returns a string from the
> > > datagrid.msg.nodata message from the
> > > org/apache/beehive/netui/databinding/datagrid/runtime/util/data-grid-def
> > > ault.properties
> > > file in the beehive-netui-tags.jar. There are no config options that I'm
> > > aware of to change this message specifically so either the property file
> > > in that jar would need to be modified or you could implement a custom
> > > pager. The custom class would extend an existing NetUI PagerRenderer
> > > such as the PreviousNextPagerRenderer class and just need to override
> > > the noDataRender() method.
> > >
> > > Maybe others on this list have some creative solutions.
> > >
> > > Good luck,
> > > Carlin
> > >
> > >
> >
>

Re: How to add default text to datagrid

Posted by Eddie O'Neil <ek...@gmail.com>.
Paul--

  If I'm understanding your question correctly, you're just trying to
get _some_ message displayed that says that there's no data.  Correct?

  Assuming that, the "no data" message is rendered by the data grid's
pager which is responsible for displaying status information about the
size of the data set.  In order for this to work, however, the pager
must render either:

- Automatically.  By default, the pager renders before the opening
<table> tag.  If the data set is empty, this is where the "no data"
message would appear.
- Manually.  In order to precisely control the location of the pager,
automatic rendering is disabled by setting

    <netui-data:configurePager disableDefaultPager="false"/>

In this case, the <netui-data:renderPager/> tag must be used to render
the pager somewhere inside the body of the <dataGrid> tag.

  Back to the original question about changing the message, there are
a variety of ways to do this; the simplest is to add this to the body
of the <dataGrid> tag:

    <netui:behavior facet="resource" name="datagrid.msg.nodata"
value="Nothing to see here."/>

This will change the behavior of the data grid by setting a new
message to display when there's no data.  If you need full i18n
capability, take a look at the <dataGrid>'s resourceBundlePath
attribute, which supports creating .properties files for all messages
rendered by the grid.

  Hope that helps.

Eddie



On Nov 13, 2007 4:28 PM, Carlin Rogers <ca...@gmail.com> wrote:
> Hi Paul,
>
> Sorry, I thought you were trying to change or remove the message. The
> actual String that is rendered from the default noDataRender() method
> is very close to what you had in your email, "No data to display".
>
> Do you have a simple repro or a fragment of the JSP you can share?
> Maybe someone on the list will be able to identify why the data grid
> in your page has a null body.
>
> Carlin
>
> On 11/13/07, Gorbas, Paul H [IT] <Pa...@sprint.com> wrote:
>
> > Thanks for the suggestions Carlin, I will follow up on them.
> >
> > One thing I should point out is I don't particularly care about the
> > exact content of the "no data" message is, my code is not displaying
> > anything (That is I get a header and footer but null body) - so that
> > default behavior you mentioned of the noDataRender() method for some
> > reason not working in my code ( Or it is working, but it is displaying a
> > null or empty string. )
> >
> >
> > -Paul G.
> >
> > -----Original Message-----
> > From: Carlin Rogers [mailto:carlin.rogers@gmail.com]
> > Sent: Tuesday, November 13, 2007 2:50 PM
> > To: Beehive Users
> > Subject: Re: How to add default text to datagrid
> >
> > Hi Paul,
> >
> > One possible solution would be to use JSTL and test the data size.
> > Between the header and footer you could put your markup within the
> > following tags...
> >
> >     <c:if test="${dataGrid.dataSet.size > 0}">
> >         ...
> >     </c:if>
> >
> >
> > Otherwise, I think it would have to be a custom pager that is configured
> > using...
> >
> >     <netui-data:configurePager pagerRendererClass="com.you.className"
> > ...>
> >
> > Looking at the implementation of the NetUI datagrid class,
> > PagerRenderer, it's noDataRender() method returns a string from the
> > datagrid.msg.nodata message from the
> > org/apache/beehive/netui/databinding/datagrid/runtime/util/data-grid-def
> > ault.properties
> > file in the beehive-netui-tags.jar. There are no config options that I'm
> > aware of to change this message specifically so either the property file
> > in that jar would need to be modified or you could implement a custom
> > pager. The custom class would extend an existing NetUI PagerRenderer
> > such as the PreviousNextPagerRenderer class and just need to override
> > the noDataRender() method.
> >
> > Maybe others on this list have some creative solutions.
> >
> > Good luck,
> > Carlin
> >
> >
>

Re: How to add default text to datagrid

Posted by Carlin Rogers <ca...@gmail.com>.
Hi Paul,

Sorry, I thought you were trying to change or remove the message. The
actual String that is rendered from the default noDataRender() method
is very close to what you had in your email, "No data to display".

Do you have a simple repro or a fragment of the JSP you can share?
Maybe someone on the list will be able to identify why the data grid
in your page has a null body.

Carlin

On 11/13/07, Gorbas, Paul H [IT] <Pa...@sprint.com> wrote:
> Thanks for the suggestions Carlin, I will follow up on them.
>
> One thing I should point out is I don't particularly care about the
> exact content of the "no data" message is, my code is not displaying
> anything (That is I get a header and footer but null body) - so that
> default behavior you mentioned of the noDataRender() method for some
> reason not working in my code ( Or it is working, but it is displaying a
> null or empty string. )
>
>
> -Paul G.
>
> -----Original Message-----
> From: Carlin Rogers [mailto:carlin.rogers@gmail.com]
> Sent: Tuesday, November 13, 2007 2:50 PM
> To: Beehive Users
> Subject: Re: How to add default text to datagrid
>
> Hi Paul,
>
> One possible solution would be to use JSTL and test the data size.
> Between the header and footer you could put your markup within the
> following tags...
>
>     <c:if test="${dataGrid.dataSet.size > 0}">
>         ...
>     </c:if>
>
>
> Otherwise, I think it would have to be a custom pager that is configured
> using...
>
>     <netui-data:configurePager pagerRendererClass="com.you.className"
> ...>
>
> Looking at the implementation of the NetUI datagrid class,
> PagerRenderer, it's noDataRender() method returns a string from the
> datagrid.msg.nodata message from the
> org/apache/beehive/netui/databinding/datagrid/runtime/util/data-grid-def
> ault.properties
> file in the beehive-netui-tags.jar. There are no config options that I'm
> aware of to change this message specifically so either the property file
> in that jar would need to be modified or you could implement a custom
> pager. The custom class would extend an existing NetUI PagerRenderer
> such as the PreviousNextPagerRenderer class and just need to override
> the noDataRender() method.
>
> Maybe others on this list have some creative solutions.
>
> Good luck,
> Carlin
>
>

RE: How to add default text to datagrid

Posted by "Gorbas, Paul H [IT]" <Pa...@sprint.com>.
Thanks for the suggestions Carlin, I will follow up on them.

One thing I should point out is I don't particularly care about the
exact content of the "no data" message is, my code is not displaying
anything (That is I get a header and footer but null body) - so that
default behavior you mentioned of the noDataRender() method for some
reason not working in my code ( Or it is working, but it is displaying a
null or empty string. )   


-Paul G.

-----Original Message-----
From: Carlin Rogers [mailto:carlin.rogers@gmail.com] 
Sent: Tuesday, November 13, 2007 2:50 PM
To: Beehive Users
Subject: Re: How to add default text to datagrid

Hi Paul,

One possible solution would be to use JSTL and test the data size.
Between the header and footer you could put your markup within the
following tags...

    <c:if test="${dataGrid.dataSet.size > 0}">
        ...
    </c:if>


Otherwise, I think it would have to be a custom pager that is configured
using...

    <netui-data:configurePager pagerRendererClass="com.you.className"
...>

Looking at the implementation of the NetUI datagrid class,
PagerRenderer, it's noDataRender() method returns a string from the
datagrid.msg.nodata message from the
org/apache/beehive/netui/databinding/datagrid/runtime/util/data-grid-def
ault.properties
file in the beehive-netui-tags.jar. There are no config options that I'm
aware of to change this message specifically so either the property file
in that jar would need to be modified or you could implement a custom
pager. The custom class would extend an existing NetUI PagerRenderer
such as the PreviousNextPagerRenderer class and just need to override
the noDataRender() method.

Maybe others on this list have some creative solutions.

Good luck,
Carlin


Re: How to add default text to datagrid

Posted by Carlin Rogers <ca...@gmail.com>.
Hi Paul,

One possible solution would be to use JSTL and test the data size.
Between the header and footer you could put your markup within the
following tags...

    <c:if test="${dataGrid.dataSet.size > 0}">
        ...
    </c:if>


Otherwise, I think it would have to be a custom pager that is
configured using...

    <netui-data:configurePager pagerRendererClass="com.you.className" ...>

Looking at the implementation of the NetUI datagrid class,
PagerRenderer, it's noDataRender() method returns a string from the
datagrid.msg.nodata message from the
org/apache/beehive/netui/databinding/datagrid/runtime/util/data-grid-default.properties
file in the beehive-netui-tags.jar. There are no config options that
I'm aware of to change this message specifically so either the
property file in that jar would need to be modified or you could
implement a custom pager. The custom class would extend an existing
NetUI PagerRenderer such as the PreviousNextPagerRenderer class and
just need to override the noDataRender() method.

Maybe others on this list have some creative solutions.

Good luck,
Carlin

On 11/13/07, Gorbas, Paul H [IT] <Pa...@sprint.com> wrote:
> Sorry, I am grasping at straws here to come up with what *should* be a
> simple solution to a common issue, but I can find a tech reference which
> covers this area.
>
> When you are using the netui:datagrid control, how do you set the
> default message which displays when the data set is null or empty?
>
> So if a DataGrid with data displays like this:
> *       HEDADER
> *       <repeat start>
> *               data rows....
> *       <repeat end>
> *       FOOTER
>
>
> That is instead of my empty datagrid just displaying:
> *       HEDADER
> *       FOOTER
>
> It would instead displays something like:
> *       HEDADER
> *               No data to be displayed.
> *       FOOTER
>
> I would like to avoid having to implement a custom pager class to
> provide this basic functionality.
>
> Thanks in advance.  If there is a link to a resource I do not know about
> for this type of information I would also appreciate getting it.
> -Paul Gorbas
>
>
>
>
>