<i id='XEdxZ'><tr id='XEdxZ'><dt id='XEdxZ'><q id='XEdxZ'><span id='XEdxZ'><b id='XEdxZ'><form id='XEdxZ'><ins id='XEdxZ'></ins><ul id='XEdxZ'></ul><sub id='XEdxZ'></sub></form><legend id='XEdxZ'></legend><bdo id='XEdxZ'><pre id='XEdxZ'><center id='XEdxZ'></center></pre></bdo></b><th id='XEdxZ'></th></span></q></dt></tr></i><div id='XEdxZ'><tfoot id='XEdxZ'></tfoot><dl id='XEdxZ'><fieldset id='XEdxZ'></fieldset></dl></div>
      <bdo id='XEdxZ'></bdo><ul id='XEdxZ'></ul>

    <small id='XEdxZ'></small><noframes id='XEdxZ'>

    <legend id='XEdxZ'><style id='XEdxZ'><dir id='XEdxZ'><q id='XEdxZ'></q></dir></style></legend>

  • <tfoot id='XEdxZ'></tfoot>

      1. 调整浏览器大小时调整jqGrid的大小?

        Resize jqGrid when browser is resized?(调整浏览器大小时调整jqGrid的大小?)

        <legend id='oQ6Df'><style id='oQ6Df'><dir id='oQ6Df'><q id='oQ6Df'></q></dir></style></legend>

        <i id='oQ6Df'><tr id='oQ6Df'><dt id='oQ6Df'><q id='oQ6Df'><span id='oQ6Df'><b id='oQ6Df'><form id='oQ6Df'><ins id='oQ6Df'></ins><ul id='oQ6Df'></ul><sub id='oQ6Df'></sub></form><legend id='oQ6Df'></legend><bdo id='oQ6Df'><pre id='oQ6Df'><center id='oQ6Df'></center></pre></bdo></b><th id='oQ6Df'></th></span></q></dt></tr></i><div id='oQ6Df'><tfoot id='oQ6Df'></tfoot><dl id='oQ6Df'><fieldset id='oQ6Df'></fieldset></dl></div>
            <tbody id='oQ6Df'></tbody>
          <tfoot id='oQ6Df'></tfoot>
          • <small id='oQ6Df'></small><noframes id='oQ6Df'>

              <bdo id='oQ6Df'></bdo><ul id='oQ6Df'></ul>
                1. 本文介绍了调整浏览器大小时调整jqGrid的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当浏览器窗口调整大小时,有没有办法调整 jqGrid 的大小?我已经尝试过描述的方法 here 但该技术在 IE7 中不起作用.

                  Is there any way to resize a jqGrid when the browser window is resized? I have tried the method described here but that technique does not work in IE7.

                  推荐答案

                  作为后续:

                  本文中显示的先前代码最终被放弃,因为它不可靠.按照 jqGrid 文档的建议,我现在使用以下 API 函数来调整网格的大小:

                  The previous code shown in this post was eventually abandoned because it was unreliable. I am now using the following API function to resize the grid, as recommended by the jqGrid documentation:

                  jQuery("#targetGrid").setGridWidth(width);
                  

                  要进行实际的调整大小,将实现以下逻辑的函数绑定到窗口的调整大小事件:

                  To do the actual resizing, a function implementing the following logic is bound to the window's resize event:

                  • 使用其父级的 clientWidth 和(如果不可用)它的 offsetWidth 属性来计算网格的宽度.

                  • Calculate the width of the grid using its parent's clientWidth and (if that is not available) its offsetWidth attribute.

                  执行完整性检查以确保宽度变化超过 x 像素(以解决一些特定于应用程序的问题)

                  Perform a sanity check to make sure width has changed more than x pixels (to work around some application-specific problems)

                  最后,使用 setGridWidth() 来改变网格的宽度

                  Finally, use setGridWidth() to change the grid's width

                  这是处理调整大小的示例代码:

                  Here is example code to handle resizing:

                  jQuery(window).bind('resize', function() {
                  
                      // Get width of parent container
                      var width = jQuery(targetContainer).attr('clientWidth');
                      if (width == null || width < 1){
                          // For IE, revert to offsetWidth if necessary
                          width = jQuery(targetContainer).attr('offsetWidth');
                      }
                      width = width - 2; // Fudge factor to prevent horizontal scrollbars
                      if (width > 0 &&
                          // Only resize if new width exceeds a minimal threshold
                          // Fixes IE issue with in-place resizing when mousing-over frame bars
                          Math.abs(width - jQuery(targetGrid).width()) > 5)
                      {
                          jQuery(targetGrid).setGridWidth(width);
                      }
                  
                  }).trigger('resize');
                  

                  以及示例标记:

                  <div id="grid_container">
                      <table id="grid"></table>
                      <div id="grid_pgr"></div>
                  </div>
                  

                  这篇关于调整浏览器大小时调整jqGrid的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                  SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                  Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)
                  Azure Functions - Import Custom Node Module(Azure Functions - 导入自定义节点模块)
                  <tfoot id='rqUGm'></tfoot>

                  <small id='rqUGm'></small><noframes id='rqUGm'>

                    <bdo id='rqUGm'></bdo><ul id='rqUGm'></ul>
                    • <i id='rqUGm'><tr id='rqUGm'><dt id='rqUGm'><q id='rqUGm'><span id='rqUGm'><b id='rqUGm'><form id='rqUGm'><ins id='rqUGm'></ins><ul id='rqUGm'></ul><sub id='rqUGm'></sub></form><legend id='rqUGm'></legend><bdo id='rqUGm'><pre id='rqUGm'><center id='rqUGm'></center></pre></bdo></b><th id='rqUGm'></th></span></q></dt></tr></i><div id='rqUGm'><tfoot id='rqUGm'></tfoot><dl id='rqUGm'><fieldset id='rqUGm'></fieldset></dl></div>

                          <legend id='rqUGm'><style id='rqUGm'><dir id='rqUGm'><q id='rqUGm'></q></dir></style></legend>
                            <tbody id='rqUGm'></tbody>