基於 bootstrap 的資料展示--bootgrid 樣式修改。,bootstrap修改樣式

來源:互聯網
上載者:User

基於 bootstrap 的資料展示--bootgrid 樣式修改。,bootstrap修改樣式

bootgrid 的官網案例


http://www.jquery-bootgrid.com/Examples

官方demo 樣式


基於項目需要,取消了一些不需要 的功能,修改了源碼


最後樣式成了這樣



以下是修改的內容


修改說明
都在 jquery bootgrid.js 中修改
css 樣式中
 css: {
            dropDownMenu: "dropdown btn-group dropup", // must be a unique class name or constellation of class names within the actionDropDown
            //修改dropDownMenu: "dropdown btn-group", 為dropDownMenu: "dropdown btn-group dropup"


   修改說明,使每頁顯示多少條記錄的 toogle 向上
       }
 templates: {
          
            //footer: "<div id=\"{{ctx.id}}\" class=\"{{css.footer}}\"><div class=\"row\"><div class=\"col-sm-6\"><p class=\"{{css.pagination}}\"></p></div><div class=\"col-sm-6 infoBar\"><p class=\"{{css.infos}}\"></p></div></div></div>",
            //修改footer為下面的
            footer: "<div id=\"{{ctx.id}}\" class=\"{{css.footer}}\"><div class=\"row\">" +
    "<div class=\"col-sm-6 \"></div><div class=\"col-sm-6\"><p class=\"{{css.actions}}\"></p><p class=\"{{css.pagination}}\"></p></div></div></div>",
            
            header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"></div>",
   }


   修改header 和 footer 。
   使 重新整理和頁數選擇的 button 顯示在下面。去掉 show page 從 x 到 x 的文字說明。




 function init()
    {
        this.element.trigger("initialize" + namespace);


        loadColumns.call(this); // Loads columns from HTML thead tag
        this.selection = this.options.selection && this.identifier != null;
        loadRows.call(this); // Loads rows from HTML tbody tag if ajax is false
        prepareTable.call(this);
        renderTableHeader.call(this);
//注釋這個,不顯示search 框
        //renderSearchField.call(this); //search 框  
//分頁 ,重新整理,隱藏列工具條在一個方法中,去修改renderActions方法
        renderActions.call(this); //分頁,重新整理,隱藏等框
        loadData.call(this);


        this.element.trigger("initialized" + namespace);
    }
  


  function renderActions()
    {
        if (this.options.navigation !== 0)
        {
            var css = this.options.css,
                selector = getCssSelector(css.actions),
                actionItems = findFooterAndHeaderItems.call(this, selector);


            if (actionItems.length > 0)
            {
                var that = this,
                    tpl = this.options.templates,
                    actions = $(tpl.actions.resolve(getParams.call(this)));


                // Refresh Button
                if (this.options.ajax)
                {
                    var refreshIcon = tpl.icon.resolve(getParams.call(this, { iconCss: css.iconRefresh })),
                        refresh = $(tpl.actionButton.resolve(getParams.call(this,
                        { content: refreshIcon, text: this.options.labels.refresh })))
                            .on("click" + namespace, function (e)
                            {
                                // todo: prevent multiple fast clicks (fast click detection)
                                e.stopPropagation();
                                that.current = 1;
                                loadData.call(that);
                            });
                    actions.append(refresh);
                }


                // Row count selection
                renderRowCountSelection.call(this, actions);//選擇一頁顯示多少行的button


                // Column selection
//注釋 這一行,不在顯示 隱藏某一列的button
                //renderColumnSelection.call(this, actions);


                replacePlaceHolder.call(this, actionItems, actions);
            }
        }
    }


labels: {
            all: "All", //選擇頁數時 all 的顯示文字
            infos: "show ${} to ${} ", //修改為空白內容。 
            loading: "Loading...", //載入時顯示的內容
            noResults: "No results found!",//未查詢到結果是顯示內容
            refresh: "Refresh", //重新整理
            search: "Search"//查詢
        },
   最後在頁面 重寫樣式
  // 分頁的樣式,主要修改 float:right
   .pagination {
             float: right;
 display: inline-block;
 padding-right: 0;
 margin: 0px 0px;
 border-radius: 4px;
}


   //重新整理和選擇一頁顯示多少條的按鈕樣式
   .btn-group{
float:right;
    }


歡迎加入 開源軟體交流群 QQ群:32730682

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.