Skip to Content
author's profile photo Former Member
Former Member

How to add the Row count(number of rows in table) in the table header?

Hi,

I'm having a table. This table is viewed when i click on a search button.

<b>On the table header it should dynamically display the number of rows in the table, i.e., the row count.</b>

How to do this? could any one explain me with the detailed procedure to achieve this.

Thanks & Regards,

Suresh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 07:35 AM

    Hi,

    if you want to get the number of rows

    Check the size of the node bound to the table.

    Ex:

    wdContext.node<YourNode>().size();

    To implement this

    Create a calculated attribute

    in the getter return the size

    bind this to the text property of the table header

    Regards

    Ayyapparaj

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Thanks Satyajit,

      its working..

      but can we two headers or two textviews, such that one is displayed on the left side showing the table name and the other one on the right side showing number of rows in the table. is it possible?

      if not help me how to show both the table name and the row count on the table header

      Thanks & Regards,

      Suresh

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 10:59 AM

    If you want to show a localized text in the table header, you should use the <b>Message Pool</b> to create a (parameterized) message "tableHeaderText" like "There are table entries".

    Next, create a context attribute "tableHeaderText" of type "string" and bind the "text" property of the table header Caption UI element to this attribute.

    Whenever the table data has changed (e.g. at the end of the supply function for the table's data source node), update the header text:

    int numRows = wdContext.node<TableDataSourceNode>().size();
    String text = wdComponentAPI.getTextAccessor().getText
    (
      IMessage<ComponentName>.TABLE_HEADER_TEXT,
      new Object[] { String.valueOf(numRows) }
    );
    wdContext.currentContextElement().setTableHeaderText(text);

    Maybe you want to provide a separate message for the case that there are no entries.

    Alternatively, you can make the attribute calculated and return the header text in the attribute getter.

    Armin

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.