You are here: Reference > JavaScript > client-side > ActiveX > ADO > properties > dataPageSize (table)

dataPageSize property (table)

Browser support:
Sets or retrieves the number of records that can be displayed in a table when data binding is used.
In HTML, only Internet Explorer supports table creation dynamically from XML. If you want to implement similar functionality in other browsers, you need to use JavaScript. For further details, see the page for the XMLHttpRequest object.

Syntax:

object.dataPageSize;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: dataPageSize

Possible values:

Integer that sets or retrieves the number of the rows in the table.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the dataPageSize attribute:
<xml id="movies">
<?xml version="1.0"?>
    <movies>
        <movie>
            <name>Clark Kent</name>
            <jobtitle>Superman</jobtitle>
            <born>1966</born>
        </movie>
        <movie>
            <name>Lois Lane</name>
            <jobtitle>Reporter</jobtitle>
            <born>1964</born>
        </movie>
    </movies>
</xml>

<table width="100%" cellpadding="0px" cellspacing="2px" border="1px" datasrc="#movies" datapagesize="2">
    <thead>
        <tr>
            <th>Name</th>
            <th>Jobtitle</th>
            <th>Born</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><span datafld="name"></span></td>
            <td><span datafld="jobtitle"></span></td>
            <td><span datafld="born"></span></td>
        </tr>
    </tbody>
</table>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the dataPageSize property:
<head>
    <script type="text/javascript">
        function ChangeSize (elem) {
            var table = document.getElementById ("myTable");

            // Returns the index of the selected option
            var whichSelected = elem.selectedIndex;


            if ('dataPageSize' in table) {
                table.dataPageSize = elem.options[whichSelected].text;
            } else {
                alert ("Your browser doesn't support this example!");
            }
        }
    </script>
</head>
<body>
    <xml id="movies">
    <?xml version="1.0"?>
        <movies>
            <movie>
                <name>Clark Kent</name>
                <jobtitle>Superman</jobtitle>
                <born>1966</born>
            </movie>
            <movie>
                <name>Lois Lane</name>
                <jobtitle>Reporter</jobtitle>
                <born>1964</born>
            </movie>
            <movie>
                <name>Fred Flintstone</name>
                <jobtitle>Caveman</jobtitle>
                <born>1970</born>
            </movie>
            <movie>
                <name>Barney Rubble</name>
                <jobtitle>Caveman</jobtitle>
                <born>1972</born>
            </movie>
        </movies>
    </xml>

    <table width="100%" cellpadding="0px" cellspacing="2px" border="1px" datasrc="#movies" datapagesize="2" id="myTable">
        <thead>
            <tr>
                <th>Name</th>
                <th>Jobtitle</th>
                <th>Born</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><span datafld="name"></span></td>
                <td><span datafld="jobtitle"></span></td>
                <td><span datafld="born"></span></td>
            </tr>
        </tbody>
    </table>

    <br />
    Change the number of records in the table!
    <select onchange="ChangeSize (this);" size="4">
        <option />1
        <option selected="selected" />2
        <option />3
        <option />4
    </select>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content