1

In my page, for first time I will show only 10 records out of 36, if viewer click next button it shows next 10 records out of 36.

My problem is table row count on table footer

I don't know how to count table row on changing (meaning when we click next button it should say "showing 10 to 20 of 36 records".

My output:

enter image description here

Expected outputs:

enter image description here

after clicking next button: enter image description here

Sample code:

<tfoot>
    <c:choose>
        <c:when test="${empty model}">
            <tr>
                <td align="left" colspan="11" style="color: orange; font-size: 12pt;">No records
                    found!</td>
            </tr>
        </c:when>
        <c:otherwise>
            <tr>
                <td align="left" colspan="11" style="color: orange; font-size: 10pt;">Showing 1 to
                    ${stlRec} of ${ttlRec} entries
            </tr>
        </c:otherwise>
    </c:choose>
</tfoot>
3
  • you are generating this html using javascript isnt it ?? Commented Oct 9, 2013 at 8:13
  • yes i m using javascript Commented Oct 9, 2013 at 8:24
  • please show us what u had done yet ?? Commented Oct 9, 2013 at 8:26

2 Answers 2

3

You can use datatables, It will satisfy all your queries and has much more extras.

Or using jquery,

var row = $('#myTable tr').length;
Sign up to request clarification or add additional context in comments.

Comments

2

The solution is very simple but you have to do some work.

  1. fix the height equal to your 10 records height.
  2. Now append your all 36 records in that and make "overflow:hidden" this will lock your from showing more than 10 records.
  3. now provide one button to see the more records, when user clicks on it make that scrollTop(100) , this will move 100 px down and if you want to move up just give -100 but in place of 100 provide height of

i am 100% sure that this trick will solve your problem, because 3 days earlier i had done the same thing ha ha ....so enjoy, thanks. :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.