加载时jquery simpleGrid禁用

时间:2015-02-23 15:42:15

标签: javascript jquery

我正在使用像这样的简单网格:

                     t.p.operatorGrid = $("#codGrid").simpleGrid({
                        dataUrl: t.p.operatorUrl,
                        columns: [
                            {name: "id", hidden: true},
                            {name: "cod", label: "Cod", width: "10%"}
                        ],

                        onSelectedCustom: function () {
                            t._enableButton(t.p.removeButton);
                        }
                    });

当我的网格从服务器加载数据并禁用对话框以便用户在网格加载时无法搜索某些内容时,如何显示加载框?

谢谢!

1 个答案:

答案 0 :(得分:2)

可以使用简单的gif加载图像。在加载数据时显示,在完成时隐藏。并可以使用

禁用对话框
  

$(选择器).attr('禁用''禁用&#39);

请参阅下面的代码,希望它有所帮助:



$(document).ready(function() {
  $("#change").on("click", function() {
    var req = $.ajax({
      type: "POST",
      url: "datapro.php",
      beforeSend: function() {
        $("#wait").css("display", "block");
      },
      complete: function() {
        $("#wait").css("display", "none");
      }
    });

  });
});

#wait {
  text-align: center;
  display: none;
  width: 200px;
  height: 89px;
  border: 0px solid black;
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 2px;
  '

}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="txt">
  <div id="result">jQuery Ajax Loading Animation</div>
</div>
<p></p>
<button id="change">Change Content</button>
<div id="wait">
  <img src='https://www.drupal.org/files/loading.gif' />
  <br />Please Wait While Loading Data ...</div>
&#13;
&#13;
&#13;