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

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

      1. <legend id='sYnqh'><style id='sYnqh'><dir id='sYnqh'><q id='sYnqh'></q></dir></style></legend>

        jqGrid setSelect 函数与参数化查询

        时间:2023-06-23

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

                  <bdo id='j4BqX'></bdo><ul id='j4BqX'></ul>
                  本文介绍了jqGrid setSelect 函数与参数化查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 jqGrid,在编辑/添加功能上,我希望在这些字段之一中有一个下拉列表.

                  I'm using jqGrid, on edit/add function I want to have a drop down list in one of these fields.

                  如果我使用 setSelect 函数,这会起作用:

                  This works if i use the setSelect function as this:

                  $grid->setSelect("title", "SELECT DISTINCT name,name as TestingName FROM template", true, true, false, array(""=>"All"));
                  

                  如何将参数传递给我的查询?我试过这些:

                  How can I pass parameters to my query? I tried these:

                  1-"SELECT DISTINCT name,name as TestingName FROM template where tempid = ?"

                  2- "SELECT DISTINCT name,name as TestingName FROM template where tempid = $rowid"

                  3-"SELECT DISTINCT name,name as TestingName FROM template where tempid = ".$rowid

                  以上都没有奏效:

                  if(isset ($_REQUEST["tempid"]))
                      $rowid = jqGridUtils::Strip($_REQUEST["tempid"]);
                  else
                      $rowid = "";
                  

                  推荐答案

                  如果我正确理解您的问题,请使用 editoptions 和 dataUrl.您想要具有附加参数 tempid 的 URL,其值应该是当前选定行的 rowid.

                  If I correct understand your question you use editoptions with dataUrl. You want to have the URL which has additional parameter tempid which value should be the rowid of the current selected row.

                  根据您问题的语法,我假设您使用了来自 trirand.net.在这种情况下,您应该使用标签 [jqgrid-php].jqGrid 是纯 JavaScript 开源产品.所以我回答你如何在 JavaScript 中添加 dataUrl 参数.

                  From the syntax of your question I suppose that you use some commercial jqGrid for PHP product from trirand.net. In the case you should use tag [jqgrid-php]. jqGrid is pure JavaScript open source product. So I answer how you can add dataUrl parameter in JavaScript.

                  jqGrid 有 ajaxSelectOptions 选项,可用于修改使用dataUrl的调用的jQuery.ajax选项.您可以执行以下操作

                  jqGrid has ajaxSelectOptions option which can be used to modify the jQuery.ajax options of the call which use dataUrl. You can do following

                  var myGrid = $("#list");
                  
                  myGrid.jqGrid({
                      // all your current parameters of jqGrid and then the following
                      ajaxSelectOptions: {
                          data: {
                              tempid: function () {
                                  return myGrid.jqGrid('getGridParam', 'selrow');
                              }
                          }
                      }
                  });
                  

                  如果jQuery.ajax的data参数包含每次调用相应的 jQuery.ajax 时都会调用一个方法而不是属性.我在 答案.

                  If the data parameter of jQuery.ajax contain a method instead of a property the method will be called every time of the corresponding jQuery.ajax call. I used the same trick in the answer.

                  这篇关于jqGrid setSelect 函数与参数化查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PHP 函数 - 忽略一些默认参数 下一篇:PHP 迭代给定月份和年份的月份中的天数

                  相关文章

                  <tfoot id='mF9Wn'></tfoot>
                • <small id='mF9Wn'></small><noframes id='mF9Wn'>

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

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