<bdo id='8KaLn'></bdo><ul id='8KaLn'></ul>

    1. <tfoot id='8KaLn'></tfoot>
    2. <small id='8KaLn'></small><noframes id='8KaLn'>

    3. <legend id='8KaLn'><style id='8KaLn'><dir id='8KaLn'><q id='8KaLn'></q></dir></style></legend>

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

        如果在免费的 jqgrid 列中单击,如何执行 ajax 调用并重定向到其他页面

        时间:2023-09-04
          <tbody id='6Rj2D'></tbody>
        <i id='6Rj2D'><tr id='6Rj2D'><dt id='6Rj2D'><q id='6Rj2D'><span id='6Rj2D'><b id='6Rj2D'><form id='6Rj2D'><ins id='6Rj2D'></ins><ul id='6Rj2D'></ul><sub id='6Rj2D'></sub></form><legend id='6Rj2D'></legend><bdo id='6Rj2D'><pre id='6Rj2D'><center id='6Rj2D'></center></pre></bdo></b><th id='6Rj2D'></th></span></q></dt></tr></i><div id='6Rj2D'><tfoot id='6Rj2D'></tfoot><dl id='6Rj2D'><fieldset id='6Rj2D'></fieldset></dl></div>
          • <bdo id='6Rj2D'></bdo><ul id='6Rj2D'></ul>
          • <tfoot id='6Rj2D'></tfoot>

              <small id='6Rj2D'></small><noframes id='6Rj2D'>

              <legend id='6Rj2D'><style id='6Rj2D'><dir id='6Rj2D'><q id='6Rj2D'></q></dir></style></legend>

                  本文介绍了如果在免费的 jqgrid 列中单击,如何执行 ajax 调用并重定向到其他页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一种方法来执行添加到购物车"ajax 调用,以从单击的行中的其他列传递产品代码(行 ID)和数量,如果在 jqgrid 列中单击,则重定向到购物车页面.

                  I'm looking for a way to perform "Add to cart" ajax call to pass product code (row id) and quantity from other columns in clicked row and redirect to cart page if clicked in jqgrid column.

                  根据https://github.com/free-jqgrid/jqGrid/wiki/improvement-of-formatter:-"showlink"

                  showlink 格式化程序已改进,因此我尝试使用它.

                  showlink formatter is improved so I tried to use it.

                  我试过 colmodel

                  I tried colmodel

                  {"label":"Add to cart",
                  "name":"Addtocrt_addtocrt","search":false,"sortable":false,
                  "viewable":false,"formatter":"showlink","formatoptions":{"showAction":addToCartOnClick
                  }}
                  

                  和方法

                  function addToCartOnClick(rowId, iRow, iCol, cellValue, e) {
                      var 
                       $quantity = $('#' + $.jgrid.jqID(rowId) + '>td:nth-child(' + (iCol + 1) + ')'),
                       quantityVal;
                      if (iCol < 0) {
                          quantityVal = 1;
                      } else
                          if ($quantity.find('>input').length === 0) {
                              quantityVal = $quantity.text();
                          }
                          else {
                              quantityVal = $quantity.find('>input').val();
                          }
                      window.location = 'Store/AddToCart?' + $.param({
                          id: rowId,
                          quantity: quantityVal
                      });
                  }
                  

                  在 jree jqgrid 中没有调用 addToCartOnClick.

                  addToCartOnClick is not called in jree jqgrid.

                  在 jqgrid 4.6 动态链接格式化程序中

                  In jqgrid 4.6 dynamiclink formatter

                  onClick=addToCartOnClick 
                  

                  按照 如果单击超链接,如何将数据从 jqgrid 行传递到 url

                  在免费的 jqgrid 中 addToCartOnClick 也不会从 dynamicLink 格式化程序中调用.

                  In free jqgrid addToCartOnClick is also not called from dynamicLink formatter.

                  如何在免费的jqgrid中调用方法并从点击的行中获取列值?

                  How to call method and get column values from clicked row in free jqgrid?

                  推荐答案

                  showAction只能用于设置URL部分.如果您想使用该选项,则必须使用 javascript: 前缀(请参阅 答案) 来启动 addToCartOnClick ,它被定义为 global 函数.

                  showAction can be used to set the part of URL only. It you want to use the option then you have to use javascript: prefix (see the answer) to start addToCartOnClick which mast be defined as the global function.

                  最好在 formatter: "showlink"formatoptions 中使用新选项 onClick.我在阅读您的之后直接对free jqGrid的代码进行了相应的修改问题.您应该从 GitHub 刷新您使用的源.现在你可以使用

                  The better would be to use new option onClick in formatoptions of formatter: "showlink". I made the corresponding changes of the code of free jqGrid directly after reading of your question. You should refresh the sources which you use from GitHub. Now you can use

                  {name: "Addtocrt_addtocrt", label: "Add to cart",
                      search: false, sortable: false, viewable: false,
                      formatter: "showlink",
                      formatoptions: {
                          onClick: function (options) {
                              // object options contains properties, which could be helpful
                              //    iCol - index of the column in colModel
                              //    iRow - index of the row
                              //    rowid
                              //    cm - element of colModel
                              //    cmName - the same as cm.name
                              //    cellValue: the text inside of `<a>`
                              //    a - DOM element of clicked <a>
                              //    event - Event object of the click event
                              location.href = "http://www.google.com/";
                              return false; // it's important to suppress the default a action
                          }
                      }}
                  

                  这篇关于如果在免费的 jqgrid 列中单击,如何执行 ajax 调用并重定向到其他页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:动态更改过滤器工具栏选项 下一篇:在 JavaScript 中返回多个值?

                  相关文章

                1. <tfoot id='4ut69'></tfoot>
                2. <legend id='4ut69'><style id='4ut69'><dir id='4ut69'><q id='4ut69'></q></dir></style></legend>

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

                    1. <small id='4ut69'></small><noframes id='4ut69'>