1

情况是我想在组合框中选择/更改值后在文本框中动态插入值。

我怎样才能做到这一点?我对 JQGrid 很陌生...

$(document).ready(function() {
  $("#datagrid").jqGrid({
      url: 'actionpo.php?vid=polpogridjq',
      datatype: 'xml',
      mtype: 'GET',
      colNames: ['List#', 'PO#', 'Item Code', 'Item Detail', 'Qty', 'Price', 'Tax'],
      colModel: [{
          name: 'polistno',
          width: 100,
          editable: true,
          editable: true,
          key: true
        },
        {
          name: 'polpono',
          index: 'polpono',
          width: 100,
          editable: true,
          key: false
        },
        {
          name: 'politemcode',
          index: 'politemcode',
          width: 100,
          align: 'right',
          sortable: true,
          editable: true,
          edittype: "select",
          editrules: {
            required: true
          },
          editoptions: {
            size: 1,

            dataUrl: 'actionpo.php?vid=populatesel',
            dataEvents: [{
                type: 'change',
                fn: function(e) {
                  var thisval = $(e.target).val();
                  $.get('actionpo.php?vid=getitemname&itemcode=' + thisval, function(data) {
                    var res = $(data).html();
                    alert(res)
                    $('#politemname').html(res);

                  }); // end get
                } //end func
              } // end type
            ] // dataevents
          } //edit options 
        },
        {
          name: 'politemname',
          id: "L1",
          width: 300,
          align: 'left',
          sortable: false,
          editable: true
        },
        {
          name: 'politemqty',
          width: 50,
          align: 'right',
          sortable: false,
          editable: true
        },
        {
          name: 'politemvalue',
          width: 80,
          align: 'left',
          sortable: false,
          editable: true
        },
        {
          name: 'politemtax',
          width: 50,
          align: 'right',
          editable: true
        }

      ],

      pager: $('#pager'),
      rowNum: 10,
      rowList: [10, 20, 30],
      sortname: 'polpono',
      sortorder: 'desc',
      shrinkToFit: false,
      rownumbers: false,
      multiselect: false,
      viewRecords: false,
      clearAfterAdd: true,
      caption: 'Itemised Quantity',
      editurl: "actionpo.php?vid=gridformcall",
    }
  ).navGrid('#pager', {
      edit: true,
      add: true,
      del: true,
      search: false,
      refresh: true
    }, {
      //Edit Options            
    }, { //Add Options
    }, {
      //Delete Options
      width: 350,
      caption: 'Delete User',
      msg: 'Are you sure you want to delete this User?\nThis action is irreversable.',
      onclickSubmit: function(rp_ge, postdata) {
        rp_ge.url = "actionpo.php?vid=gridformcall&delpono=" +
          $('#datagrid').getCell(postdata, 'polpono');
      }
    }, {} //Search options 
  );
});

文本框是“politemname”,下拉列表是“politemcode”。组合列表工作正常,只是我无法将从下面的代码中收到的值分配给文本框。

$.get('actionpo.php?vid=getitemname&itemcode='+thisval, function(data)

还有一种方法可以从 JQgrid 中的模态表单中获取元素(我认为是 CSS)名称的 id 吗?

4

0 回答 0