You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by dharmendra pandey <dh...@gmail.com> on 2014/08/17 08:28:32 UTC

DataTable adding one more div/span based on dynamic conditions

Hi,

I am using the DataTable to render the data in tabular format and overridden
the populateItem method to insert the span in case of particular scenario as
mentioned below..

I have done the below way but think  can be done in better ways.. earlier I
have used the Fragment and was unable to add a div/span....

Could you please suggest...

------------------------------------------------------------------------------------------------------------------
@Override
public void populateItem(Item<ICellPopulator&lt;LabTestData>> item, String
componentId, IModel<LabTestData> rowModel) {

            if ("colourName".equals(getPropertyExpression())) {
                item.add(new Label(componentId, "&nbsp;&nbsp;&nbsp; &nbsp;"
                        +
rowModel.getObject().getColourName()).setEscapeModelStrings(false));
               item.add(new AttributeModifier("title", new
Model<String>(rowModel.getObject().getColourName())));

            } else {
                item.add(new Label(componentId, getDataModel(rowModel)));
            }

        }

-------------------------------------------------------------------------------------------------------------------

 private class ColorPanelFragment extends Fragment {

        private static final long serialVersionUID = 1L;

        public ColorPanelFragment(String id, String markupId,
MarkupContainer markupProvider) {
            super(id, markupId, markupProvider);
        }
    }
-------------------------------------------------------------------------------------------------------------------


Regards
Dharmendra Pandey


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataTable-adding-one-more-div-span-based-on-dynamic-conditions-tp4667064.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DataTable adding one more div/span based on dynamic conditions

Posted by dharmendra pandey <dh...@gmail.com>.
Thanks Martin..


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataTable-adding-one-more-div-span-based-on-dynamic-conditions-tp4667064p4667097.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DataTable adding one more div/span based on dynamic conditions

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Use a Panel for the cell and put as many children components inside your
panel as you need.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Mon, Aug 18, 2014 at 3:34 PM, dharmendra pandey <
dharmendra.panday@gmail.com> wrote:

> Hi Martin,
>
> My question is simple.
>
> I have used DataTable to render data in table formats.
> I want to add one more extra Label (total 2 labels)in a cell..
>
> More than one label/component wicket framework DataTable is not allowing(As
> I see only on div with id cell).
>
> Regards
> Dharmendra Pandey
>
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/DataTable-adding-one-more-div-span-based-on-dynamic-conditions-tp4667064p4667095.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: DataTable adding one more div/span based on dynamic conditions

Posted by dharmendra pandey <dh...@gmail.com>.
Hi Martin,

My question is simple.

I have used DataTable to render data in table formats.
I want to add one more extra Label (total 2 labels)in a cell..

More than one label/component wicket framework DataTable is not allowing(As
I see only on div with id cell).

Regards
Dharmendra Pandey






--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DataTable-adding-one-more-div-span-based-on-dynamic-conditions-tp4667064p4667095.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DataTable adding one more div/span based on dynamic conditions

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

The question is not clear to me.
I don't see how/where you want to use the fragment. And I don't understand
what is the problem with it.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Sun, Aug 17, 2014 at 8:28 AM, dharmendra pandey <
dharmendra.panday@gmail.com> wrote:

>
> Hi,
>
> I am using the DataTable to render the data in tabular format and
> overridden
> the populateItem method to insert the span in case of particular scenario
> as
> mentioned below..
>
> I have done the below way but think  can be done in better ways.. earlier I
> have used the Fragment and was unable to add a div/span....
>
> Could you please suggest...
>
>
> ------------------------------------------------------------------------------------------------------------------
> @Override
> public void populateItem(Item<ICellPopulator&lt;LabTestData>> item, String
> componentId, IModel<LabTestData> rowModel) {
>
>             if ("colourName".equals(getPropertyExpression())) {
>                 item.add(new Label(componentId, "&nbsp;&nbsp;&nbsp; &nbsp;"
>                         +
> rowModel.getObject().getColourName()).setEscapeModelStrings(false));
>                item.add(new AttributeModifier("title", new
> Model<String>(rowModel.getObject().getColourName())));
>
>             } else {
>                 item.add(new Label(componentId, getDataModel(rowModel)));
>             }
>
>         }
>
>
> -------------------------------------------------------------------------------------------------------------------
>
>  private class ColorPanelFragment extends Fragment {
>
>         private static final long serialVersionUID = 1L;
>
>         public ColorPanelFragment(String id, String markupId,
> MarkupContainer markupProvider) {
>             super(id, markupId, markupProvider);
>         }
>     }
>
> -------------------------------------------------------------------------------------------------------------------
>
>
> Regards
> Dharmendra Pandey
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/DataTable-adding-one-more-div-span-based-on-dynamic-conditions-tp4667064.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>