cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div id="myRepeater" class="repeater" data-staticheight="true">

    <div class="repeater-header">
        <div class="repeater-header-left">
            <div class="repeater-search">
                <div class="search disabled input-group">
                    <input type="search" class="form-control" placeholder="Search" />
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="button">
                            <span class="glyphicon glyphicon-search"></span>
                            <span class="sr-only">Search</span>
                        </button>
                    </span>
                </div>
            </div>
        </div>
        <div class="repeater-header-right">
            <div class="btn-group selectlist disabled repeater-filters">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                    <span class="selected-label"></span>
                    <span class="caret"></span>
                    <span class="sr-only">Toggle Filters</span>
                </button>
                <ul class="dropdown-menu pull-right" role="menu">
                    <li data-value="all" data-selected="true" data-property="all"><a href="#">All Items</a></li>
                    <li class="divider"></li>
                    <li data-value="draft" data-property="status"><a href="#">Draft</a></li>
                    <li data-value="archived" data-property="status"><a href="#">Archived</a></li>
                    <li data-value="active" data-property="status"><a href="#">Active</a></li>
                </ul>
                <input class="hidden hidden-field" name="filterSelection" readonly="readonly" aria-hidden="true" type="text" />
            </div>
        </div>
    </div>


    <div class="repeater-viewport">
        <div class="repeater-canvas"></div>
        <div class="loader repeater-loader"></div>
    </div>


    <div class="repeater-footer">
        <div class="repeater-footer-left">
            <div class="repeater-itemization">
                <span>
                    <span class="repeater-start"></span> - <span class="repeater-end"></span> of <span class="repeater-count"></span> items
                </span>
                <div class="btn-group selectlist dropup" data-resize="auto">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        <span class="selected-label"></span>
                        <span class="caret"></span>
                        <span class="sr-only">Toggle Dropdown</span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li data-value="10" data-selected="true"><a href="#">10</a></li>
                        <li data-value="25"><a href="#">25</a></li>
                        <li data-value="50"><a href="#">50</a></li>
                    </ul>
                    <input class="hidden hidden-field" name="itemsPerPage" readonly="readonly" aria-hidden="true" type="text" />
                </div>
                <span>Per Page</span>
            </div>
        </div>
        <div class="repeater-footer-right">
            <div class="repeater-pagination">
                <button type="button" class="btn btn-default btn-sm repeater-prev">
                    <span class="glyphicon glyphicon-chevron-left"></span>
                    <span class="sr-only">Previous Page</span>
                </button>
                <label class="page-label" id="myPageLabel">Page</label>
                <div class="repeater-primaryPaging active">
                    <div class="input-group input-append dropdown combobox dropup">
                        <input type="text" class="form-control" aria-labelledby="myPageLabel" />
                        <div class="input-group-btn">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                <span class="caret"></span>
                                <span class="sr-only">Toggle Dropdown</span>
                            </button>
                            <ul class="dropdown-menu dropdown-menu-right"></ul>
                        </div>
                    </div>
                </div>
                <input type="text" class="form-control repeater-secondaryPaging" aria-labelledby="myPageLabel" />
                <span>of <span class="repeater-pages"></span></span>
                <button type="button" class="btn btn-default btn-sm repeater-next">
                    <span class="glyphicon glyphicon-chevron-right"></span>
                    <span class="sr-only">Next Page</span>
                </button>
            </div>
        </div>
    </div>

</div>

            
          
!
            
              #myRepeater {
    position: absolute;
    top: 25px;
    right: 25px;
    bottom: 25px;
    left:25px;
}
            
          
!
            
              // Clear the console on every subsequent run.
// There are many points below where you can
// uncomment a console.log to gain better
// understanding of how this code works.
console.clear();



// Define the data to be displayed in the repeater.
function staticDataSource(options, callback) {

    // Define the columns for the grid
    var columns = [{
        'label': 'Name', // Column header label.
        'property': 'name', // The JSON property you are binding to.
        'sortable': true // Is the column sortable.
    }, {
        'label': 'Description',
        'property': 'description',
        'sortable': true
    }, {
        'label': 'Status',
        'property': 'status',
        'sortable': true
    }, {
        'label': 'Category',
        'property': 'category',
        'sortable': true
    }];

    // Generate the rows in your dataset.
    // NOTE: The property names of your items should
    // match the column properties defined above.
    function generateDummyData() {
        var items = [];
        var amountOfItems = 100; //Change this number
        var statuses = ['Archived', 'Active', 'Draft'];
        var categories = ['New', 'Old', 'Upcoming'];

        function getRandomStatus() {
            var index = Math.floor(Math.random() * statuses.length);
            return statuses[index];
        }

        function getRandomCategory() {
            var index = Math.floor(Math.random() * categories.length);
            return categories[index];
        }

        for (var i = 1; i <= amountOfItems; i++) {
            var item = {
                id: i,
                name: 'Item ' + i,
                description: 'Desc ' + i,
                status: getRandomStatus(),
                category: getRandomCategory()
            }
            items.push(item);
        };

        // Uncomment these to see in your console the
        // JSON payload produced by this function.
        //console.log(JSON.stringify(items));
        //console.table(items);

        return items;
    }

    var items = generateDummyData();

    // These are the visible UI options of the repeater,
    // such as how many items to display per page. They
    // are provided by the Fuel library.
    //console.log(options);

    // Set the values that will be used in your dataSource.
    var pageIndex = options.pageIndex;
    var pageSize = options.pageSize;
    var totalItems = items.length;
    var totalPages = Math.ceil(totalItems / pageSize);
    var startIndex = (pageIndex * pageSize) + 1;
    var endIndex = (startIndex + pageSize) - 1;
    if (endIndex > totalItems) {
        endIndex = totalItems;
    }
    var rows = items.slice(startIndex - 1, endIndex);

    // Define the datasource.
    var dataSource = {
        'page': pageIndex,
        'pages': totalPages,
        'count': totalItems,
        'start': startIndex,
        'end': endIndex,
        'columns': columns,
        'items': rows
    };

    //console.log(dataSource);

    // Pass the datasource back to the repeater.
    callback(dataSource);
}



// Initialize the repeater.
$('#myRepeater').repeater({
    // Setup your custom datasource to handle data retrieval;
    // responsible for any paging, sorting, filtering, searching logic.
    dataSource: staticDataSource,
    // Other options can be placed here as well, such as text to
    // display if no data is returned.
    list_noItemsHTML: "No items found."
    // See: getfuelux.com/javascript.html#repeater-usage-options
    // for more options to put here.
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console