需要使用Database值加载对话框弹出窗口

时间:2015-08-07 06:43:00

标签: javascript jquery jsp jqgrid

我需要打开一个jquery对话框弹出窗口,其中包含从数据库加载的数据。我能够在控制器中看到结果数据,但无法在对话框弹出窗口中查看相同的数据。

对此有何帮助?

这是我的代码:

popup.jsp

<div id="addDeployment"  style="display: none">
        <table id="addDep">
            <tbody>
            <tr>
                    <td width="50%"><label id="AddDeployedCityLab">Deployed City</label></td>
                    <td width="50%"><input type="text" name="AddDeployedCity"   id="AddDeployedCity" value="" /></td>
            </tr>
            <tr>
                    <td width="50%"><label id="AddDeployedStateLab">Deployed State</label></td>
                    <td width="50%"><input type="text"  name="AddDeployedState" id="AddDeployedState" value=""></td>
            </tr>

            <tr>
                    <td width="50%"><label id="AddDeployedTerrirotyLab">Territory Name</label></td>
                    <td width="50%"><input type="text" name="AddDeployedTerriroty" id="AddDeployedTerriroty" value=${territoryName}></td>
            </tr>

            <tr>
                    <td width="50%"><label id="AddDeployedEffDateLab">Effective Date</label></td>
                    <td width="50%"><input type="text" name="AddDeployedEffDate" id="AddDeployedEffDate" value=${effectiveDate}></td>
            </tr>
            <tr>
                    <td width="50%"><label id="AddDeployedExpDateLab">Expiry Date</label></td>
                    <td width="50%"><input type="text" name="AddDeployedExpDate" id="AddDeployedExpDate" value=${expiryDate}></td>
            </tr>

            <tr>
                    <td width="50%"><label id="AddDeployedZipLab">Zipcodes</label></td>
                    <td width="50%">
                    <select id="AddDeployedZip" multiple="multiple">
                    </select>
                    </td>
            </tr>
            </tbody>
        </table>
    </div>

jQuery代码:

$( “#addDeploymentBut”)。单击(函数(){

    var usw=$("#DeployGrid").jqGrid("getCell",deployVal,"usw");
    var deploymentTyp=$("#DeployGrid").jqGrid("getCell",deployVal,"deploymentTyp");
    var territory=$("#DeployGrid").jqGrid("getCell",deployVal,"territoryName");
    var effDate=$("#DeployGrid").jqGrid("getCell",deployVal,"effectiveDate");
    var expDate=$("#DeployGrid").jqGrid("getCell",deployVal,"expiryDate");

    var passParam="/Scheduling/deploymentAddModal?deployType="+deploymentTyp+"&usw="+usw+"&territory="+territory+"&effDate="+effDate+"&expDate="+expDate;

    $("#addDeployment").dialog({
        title: "Add Deployment",
        width: 430,
        height: 320,
        modal: true,
        open: function () {
            /*$("#addDeployment").load(passParam,function(event){
                event.preventDefault();                 
            });  */
            $.ajax({
                type : "POST",
                url : passParam,
                async : false,
                dataType: "json",
                success : function(data) {          
                     $("#addDeployment").load("deploymentAddModal.jsp");                                             
                }

            }); 

        },
        buttons: {
        Close: function() {
            $("#addDeployment").dialog('close');                
        }           
        }
        });

})

另一个jsp

<input type="button" id="addDeploymentBut" value="Add" />

1 个答案:

答案 0 :(得分:0)

查看id="addDeployment"我发现它总是display:none

通过javascript删除display:none。比如display:inline

document.getElementById('addDeployment').style.display = 'block';
document.getElementById('addDeployment').style.display = 'inline';