Wijmo UI for the Web
Bootstrap
Wijmo User Guide > Concepts > Integrating Frameworks > Bootstrap

You can use Bootstrap instead of a Wijmo theme to customize the look of all of your Wijmo widgets. To do so, add references to the Bootstrap CSS stylesheet, Bootstrap JS, our Wijmo Bootstrap CSS stylesheet, and our Wijmo Bootstrap JS file.

Drop down to see all of the references required to use Bootstrap in the correct order

References
Copy Code
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">

<!-- Wijmo Bootstrap CSS -->
<link href="http://cdn.wijmo.com/interop/bootstrap-wijmo.css" rel="stylesheet" type="text/css" />

<!--Wijmo Widgets CSS-->
<link href="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20183.140.min.css" rel="stylesheet" type="text/css" />

<!--RequireJs-->
<script type="text/javascript" src="http://requirejs.org/docs/release/2.1.8/comments/require.js"></script>
<script type="text/javascript">
    requirejs.config({
        baseUrl: "http://cdn.wijmo.com/amd-js/3.20161.90",
            paths: {
                "jquery": "jquery-1.11.1.min",
                "jquery-ui": "jquery-ui-1.11.0.custom.min",
                "jquery.ui": "jquery-ui",
                "jquery.mousewheel": "jquery.mousewheel.min",
                "globalize": "globalize.min",
                "knockout": "knockout-3.1.0" //Only if you use Knockout
            },
    });
</script>

Also, when you use Bootstrap.js, it is important to note that jQuery and Bootstrap each have their own buttons, and many Wijmo widgets use the jQuery buttons. To make the buttons compatible with Bootstrap, add these two lines of code after 'bootstrap-wijmo' module loading is completed.

var btn = $.fn.button.noConflict() // reverts $.fn.button to jqueryui btn
$.fn.btn = btn // assigns bootstrap button functionality to $.fn.btn

Here are the two lines of code in the context of the document ready function that you can add to the <head> section of your HTML file below all of the references.

Drop down to see jQuery Script for a grid

Script
Copy Code
<script type="text/javascript">
    var viewModel;

    require(["wijmo.widget", "knockout.wijmo", "wijmo.wijgrid"], function () {
        require(["bootstrap.wijmo"], function () {
            function ViewModel() {
                var productsView = new wijmo.data.ArrayDataView(getData(25), {
                    pageSize: 10
                });

                this.products = productsView;
                this.clearPaging = function () {
                    productsView.pageSize(0);
                };
                this.setPaging = function () {
                    productsView.pageSize(10);
                };
                this.prevPage = function () {
                    productsView.prevPage();
                };
                this.nextPage = function () {
                    productsView.nextPage();
                };
            }

            // random data generators
            function getData(count) {
                var data = [];
                var name = "Lorem,Ipsum,Dolor,Amet,Consectetur,Adipiscing,Elit,Vivamus,Pharetra,Velit,Eget,Imperdiet,Mattis,Egestas,Donec,Tempus,Vestibulum,Tincidunt,Blandit,Lacinia,Lobortis,Feugiat,Mauris,Massa,Rutrum,Pulvinar,Ornare,Facilisi,Sociis,Natoque,Penatibus".split(",");
                var suffix = "LLC,Inc,International,Transpacific,Services,Financial,Enterprises,Consultants,Foundation,Institute".split(",");
                for (var i = 0; i < count; i++) {
                    data.push({
                        TransactionID: i,
                        ProductName: getString(name) + " " + getString(suffix),
                        UnitPrice: getNumber(10, 100),
                        Quantity: Math.floor(getNumber(1, 500)),
                        Discount: getNumber(0, 0.3),
                        OrderDate: getDate(i),
                        Overseas: Math.random() > 0.8
                    });
                }
                return data;
            }
            function getString(arr) {
                return arr[Math.floor((Math.random() * arr.length))];
            }
            function getNumber(lo, hi) {
                return lo + Math.random() * (hi - lo);
            }
            function getDate(daysAgo) {
                return new Date((new Date()).getTime() - daysAgo * 24 * 3600 * 1000);
            }

            $(document).ready(function () {
                viewModel = new ViewModel();
                ko.applyBindings(viewModel);
            });

        });
        
  });
</script>

Here is a live widget showing a Grid using a Bootstrap theme.

See Also