0

我正试图让我的 jqGrid 在单击按钮时加载数据......到目前为止,我的按钮已准备好可以单击,如您所见。问题是,我有些方式或其他方式没有正确获取导航信息......我正在尝试 AJAX 调用一个这样设置的@HTML.BeginForm......

@using(Html.BeginForm("returnJSONEncoutnerData", "AddEncounter", new { popId = (int)TempData["POPULATIONID"]}, FormMethod.Post, new { id = "SearchPatID" }))

这是我的按钮点击功能。

$('#submit').click(function (event) {
        //alert("What the FONK is going on here!");
        debugger;
        var theURL = $("#SearchPatID").action;
        var type = $("#SearchPatID").methd;
        event.preventDefault();
        $.ajax({
            url: this.action,
            type: this.method,
            data: $(this).serialize(),
            dataType: "json",
            success: function (result) {
                bindCustomers();
            }
        });
        return false;
    });

我的函数 bindCustomer 应该用上述方法收集并 JSON 化的 JSON 数据填充 jqGrid!我想我会把它放在那里来消除你的好奇心。

 var bindCustomers = function () {
    alert('');
    $("#list").jqGrid({
        url: $("#DisplayUniqueEncounters").attr("action"), //'/Home/GridData/',
        gridview: false,
        shrinkToFit: false,
        autowidth: true,
        datatype: 'json',
        mtype: 'POST',
        colNames: ['Edit',
                   'MRN',
                   'Hospital Fin',
                   'First Name',
                   'Last Name',
                   'Date of birth',
                   'Completed Pathway',
                   'Completed Pathway Reason',
                   'PCP Appointment',
                   'Specialist Appointment',
                   'Admit Date',
                   'Discharge Date',
                   'Discharge Disposition',
                   'Discharge To',
                   'Discharge Advocate Call',
                   'Home Healthcare',
                   'Safe Landing Accepted',
                   'PCP Name',
                   'PCP Phone',
                   'PCP Appointment Location',
                   'Specialist Name',
                   'Specialist Phone',
                   'Specialist Appointment Location',
                   'Comments',
                   'Patient Room Phone',
                   'Phone',
                   'Payor',
                   'MRN Type'
                   ],
        colModel: [
                   { name: 'Edit', width: 95, align: 'left' },
                   { name: 'MRN', width: 125, align: 'left' },
                   { name: 'Hospital_Fin', width: 145, align: 'left' },
                   { name: 'First_Name', width: 115, align: 'left' },
                   { name: 'Last_Name', width: 115, align: 'left' },
                   { name: 'Date_of_birth', width: 145, align: 'left' },
                   { name: 'Completed_Pathway', width: 125, align: 'left' },
                   { name: 'Completed_Pathway_Reason', width: 165, align: 'left' },
                   { name: 'PCP_Appointment', width: 115, align: 'left' },
                   { name: 'Specialist_Appointment', width: 125, align: 'left' },
                   { name: 'Admit_Date', width: 185, align: 'left' },
                   { name: 'Discharge_Date', width: 185, align: 'left' },
                   { name: 'Discharge_Disposition', width: 155, align: 'left' },
                   { name: 'Discharge_To', width: 85, align: 'left' },
                   { name: 'Discharge_Advocate_Call', width: 155, align: 'left' },
                   { name: 'Home_Health_Care_Accepted', width: 105, align: 'left' },
                   { name: 'Safe_Landing_Accepted', width: 165, align: 'left' },
                   { name: 'PCP_Name', width: 85, align: 'left' },
                   { name: 'PCP_Phone', width: 85, formatter: formatPhoneNumber, align: 'left' },
                   { name: 'PCP_Appointment_Location', width: 185, align: 'left' },
                   { name: 'Specialist_Name', width: 195, align: 'left' },
                   { name: 'Specialist_Phone', width: 135, formatter: formatPhoneNumber, align: 'left' },
                   { name: 'Specialist_Appointment_Location', width: 185, align: 'left' },
                   { name: 'Comments', width: 185, align: 'left' },
                   { name: 'Patient_Room_Phone', width: 135, formatter: formatPhoneNumber, align: 'left' },
                   { name: 'Phone', width: 125, formatter: formatPhoneNumber, align: 'left' },
                   { name: 'Payor', width: 155, align: 'left' },
                   { name: 'MRN_Type', width: 135, align: 'left' }
                   ],
        //pager: jQuery('#pager'),
        rowNum: 10,
        rowList: [5, 10, 20, 50],
        sortname: 'Id',
        sortorder: "desc",
        viewrecords: true,
        imgpath: '/scripts/themes/coffee/images',
        caption: 'My first grid'
    });
}

我需要在某个时候将数据异步返回给我。但此时乞丐不能成为选择者。我需要弄清楚为什么我无法获得正确的路由信息​​。

4

1 回答 1

0

this是按钮,而不是表单。
它没有action.

您应该submit改为处理表单的事件,这this将是表单。

于 2012-06-07T19:13:12.243 回答