GEASSTRY
星辰Kee
采纳率33.3%
2017-03-01 07:13

在jsp页面应用了FlexiGrid表格插件,JavaScript对类为“modify”绑定的事件无响应了,怎么破?

哪位大神能说说是啥情况?卡壳好几天了

显示按钮如下,修改按钮的class为“modify”

图片说明

JSP源码如下

                <table class="flexme1">
                                <thead>
                                <tr>
                                    <th width="60">操作</th>
                                    <th width="80">户名</th>
                                    <th width="100">用户编号</th>
                                    <th width="100">表计名称</th>
                                    <th width="100">表计编号</th>
                                    <th width="50">累计用量</th>
                                    <th width="30">倍率</th>
                                    <th width="40">开关阀</th>
                                    <th width="100">集中器地址</th>
                                    <th width="30">序号</th>
                                    <th width="50">表计状态</th>
                                    <th width="50">用户大类</th>
                                    <th width="50">通信速率</th>
                                    <th width="50">端口</th>
                                    <th width="80">表身码</th>
                                    <th width="350">表安装安置</th>
                                </tr>
                                </thead>
                                <tbody>
                                    <c:forEach items="${pageList}" var="cInfo" varStatus="loop">
                                    <tr>
                                        <td>
                                            <c:if test="${pv:validate(userPermissions,'0205','03')}">
                                                <img src="../images/icon/edit.png" style="cursor: pointer;"
                                                    class="modify" width="16" height="16" alt="save" title="修改" />
                                            </c:if> 
                                            <c:if test="${pv:validate(userPermissions,'0205','04')}">
                                                <img src="../images/icon/delete.png" style="cursor: pointer;"
                                                    class="delete" width="16" height="16" alt="delete" title="删除" />
                                            </c:if>
                                            <c:if test="${pv:validate(userPermissions,'0205','04')}">
                                                <img src="../images/icon/cog.png" style="cursor: pointer;"
                                                    class="set" width="16" height="16" alt="set" title="设置" />
                                            </c:if>
                                        </td>                           
                                        <td>${cInfo.userName}</td>
                                        <td>${cInfo.houseHoldId}</td>
                                        <td>${cInfo.meterName}</td>
                                        <td><a href="${AppPath}/monitor/meterMonitor.do?command=query&meterCode=${cInfo.meterCode}" >${cInfo.meterCode}</a></td>
                                        <%-- 
                                        <td>${cInfo.meterCode}</td>
                                         --%>
                                        <td>${cInfo.lastestDegree}</td>
                                        <td>${cInfo.PT}</td>
                                        <td>
                                            <c:if test="${cInfo.valvesState==1}">开阀</c:if>
                                            <c:if test="${cInfo.valvesState==0}">关阀</c:if>
                                        </td>
                                        <td>${cInfo.crAddress}</td>
                                        <td>${cInfo.seq}</td>
                                        <td>
                                            <c:if test="${cInfo.status==0}">初始化</c:if>                                        
                                            <c:if test="${cInfo.status==1}">正常</c:if>
                                            <c:if test="${cInfo.status==2}">异常</c:if>
                                            <c:if test="${cInfo.status==3}">断电拉闸</c:if>
                                        </td>
                                        <td>
                                            <c:if test="${cInfo.bigType==0}">冷水表</c:if>
                                            <c:if test="${cInfo.bigType==1}">中水表</c:if>                                       
                                        </td>
                                        <td>
                                            <c:if test="${cInfo.bps==0}">默认</c:if>
                                            <c:if test="${cInfo.bps==1}">600</c:if>
                                            <c:if test="${cInfo.bps==2}">1200</c:if>
                                            <c:if test="${cInfo.bps==3}">2400</c:if>
                                            <c:if test="${cInfo.bps==4}">4800</c:if>
                                            <c:if test="${cInfo.bps==5}">7200</c:if>
                                            <c:if test="${cInfo.bps==6}">9600</c:if>
                                            <c:if test="${cInfo.bps==7}">19200</c:if>                                           
                                        </td>
                                        <td>
                                            <c:if test="${cInfo.port==1}">MBUS1</c:if>
                                            <c:if test="${cInfo.port==2}">MBUS2</c:if>
                                            <c:if test="${cInfo.port==3}">MBUS3</c:if>
                                            <c:if test="${cInfo.port==4}">MBUS4</c:if>                                          
                                        </td>

                                        <td>${cInfo.virAddress}</td>
                                        <td>${accountAddressMap[cInfo.accountCode]}</td>
                                    </tr>

                                    </c:forEach>
                                </tbody>
                </table>



<div class="msgbox1 pz1" id="draggable" style="display:none;">
<div class="menu">
    <span> <a href="#" onclick="$('#draggable').fadeOut('slow');return false;" style="cursor: pointer;">关闭窗口</a> </span>
    <h1>详细信息</h1>
</div>
<ul class="infobox">
    <li><span>表计编码:</span>
    <input type="hidden" id="Detail_status" value="0" />
    <input id="Detail_meterCode" type="text" size="25" maxlength="20" class="input1" value="" /> 
    <label class="Red" title="必填项">*</label>
    <label id="feedback_meterCode"></label>
    </li>
    <li><span>表计名称:</span>
    <input id="Detail_meterName" type="text" size="25" maxlength="20" class="input1" value="" />
    <label class="Red">*</label>
    <label id="feedback_meterName"></label>
    </li>
    <li><span>集中器地址:</span> 
    <input id="Detail_crAddress" type="hidden" size="15" maxlength="12" class="input1" value="" />
    <input id="Detail_crAddressDesc" type="text" size="27" maxlength="12" class="input1" value="" readonly="readonly"/>
    <label class="Red">*</label>
    <label id="feedback_crAddress"></label>
    </li>
    </li>
    <li><span>户名:</span> 
    <input id="Detail_userName" type="text" size="27" maxlength="12" class="input1" value="" />
    <label id="feedback_userName"></label>
    </li>   
    <li><span>生产厂家:</span>
    <input id="Detail_factoryId" type="hidden" class="input1" />
    <input id="Detail_factoryDesc" type="text" size="25" maxlength="20" class="input1" readonly="readonly" />
    <label class="Red">*</label>
    <label id="feedback_factoryId"></label>
    </li>
    <li id="location"><span>所在房间:</span>
    <input id="Detail_accountCode" type="hidden" class="input1" />
    <input id="Detail_locationCodeDesc" type="text" size="25" maxlength="20" class="input1" value="" readonly="readonly" />
    <label class="Red">*</label>
    <label id="feedback_location"></label>
    </li>

    <li class="bot">
    <input type="hidden" id="Detail_Id" value="" /> 
    <label class="pad_zy10"><input type="button" id="save" class="xiugai1"/></label>
    <label class="pad_zy10"><input type="button" id="quxiao" class="quxiao1"  onclick="$('#draggable').fadeOut('slow');return false;" /></label></li>
</ul>
    <div class="clear"></div>
</div>

JavaScript代码如下

function showDetailWindow(obj){
    alert('123');
    if (obj.id == null){
        obj = this;
    }
    $("#draggable label[id^='feedback_']").attr("innerHTML","");
    $("#save").removeClass().addClass("xiugai1");
    var id = $(obj).parents("ul:first").attr("id").replace("TR","");
    loadInfo(id);
    $("#draggable").fadeIn("slow");
}

/**
 * 加载详细信息
 */
function loadInfo(id){


    $("#Detail_crAddressDesc").attr("disabled","disabled");
    var items = ["status","meterCode","meterName","userName","crAddressDesc","factoryDesc","locationCodeDesc","locationNmae",
                        "locationNmae","virAddress","lineCode","crAddress","factoryId","accountCode","type","relay","boxCode","rateVolt","rateCurr",
                       "CT","PT","collector","lineType","level","parentCode",
                       "typeK","typeH","typeF","typeS","typeG","measupe",
                       "protocol","rate","gauge","model","energyItem","energyAttribute",
                       "seq","isTotal","crCode","smallType","bigType","port","bps"];

    $.ajax({
        type : 'POST',
        url  : 'meter.do',
        data : {
            command : "detail",
            meterId : id
        },
        dataType  : "json",
        cache : false,
        timeout  : 30000,
        success: function(msg){
            if (msg.meter){
                $("#Detail_Id").attr("value", id);
                for(var i=0;i<items.length;i++){
                    $("#Detail_"+items[i]).attr("value", msg.meter[items[i]]);
                }
                $("#Detail_crAddressDesc").attr("value",msg.crAddressDesc);             
                $("#Detail_locationCodeDesc").attr("value", msg.locationCodeDesc);
                $("#Detail_factoryDesc").attr("value",msg.factoryDesc);
                $("#Detail_houseHoldId").attr("value",msg.houseHoldId);
                $("#Detail_userName").attr("value",msg.userName);
                $("#Detail_virAddress").attr("value",msg.virAddress);
                $("#draggable").fadeIn("slow");
            }
        },
        error : function(){
            //$("#feedback").attr("innerHTML","<strong>"+ajaxfeedback_exception+"</strong>");
           // $("#feedback").removeClass().addClass("Red").fadeIn("slow");
              showFeedback(ajaxfeedback_exception);
        }
    });
}

/**
 * 保存信息
 */
function save(){
    $("#Detail_lineCode").val("2");
     if($("#Detail_status").val()==""||$("#Detail_status").val()==null){
           $("#Detail_status").val("0");
       }
    var flag = validate();
    if (flag == false){
        return ;
    }
    var items=["status","meterCode","meterName","crAddress","userName","PT","factoryId","accountCode","locationNmae",
               "virAddress","lineCode","type","relay","boxCode","rateVolt","rateCurr",
               "CT","PT","collector","lineType","level","parentCode",
               "typeK","typeH","typeF","typeS","typeG","measupe",
               "protocol","rate","gauge","model","energyItem","energyAttribute",
               "seq","isTotal","crCode","smallType","bigType","port","bps"];
    var data={
             command : "saveOrUpdate",
             meterId : $.trim($("#Detail_Id").attr("value")),
             energyType : $.trim($("#type").attr("value")),
             houseHoldId :$.trim($("#Detail_houseHoldId").attr("value")),
             virAddress : $.trim($("#Detail_virAddress").attr("value"))
    };
    for(var i=0;i<items.length;i++){
        data[items[i]]=$.trim($("#Detail_"+items[i]).attr("value"));
    }
    $.ajax({
        type : 'POST',
        url  : 'meter.do',
        data : data,
        dataType  : "json",
        cache : false,
        timeout  : 30000,
        success: function(msg){
            if (msg.status){
                $("#draggable").fadeOut("slow");
                //$("#feedback").attr("innerHTML",msg.msg);
              // jump();  
                showFeedback(msg.msg,true);
                //$("#feedback").addClass("Blue").fadeIn("slow").fadeOut("slow");
                //$("[id^='feedback_']").removeClass().attr("innerHTML", "");

            }else{
                //服务器端验证失败或者异常反馈信息
                if ($.trim(msg.msg)!= ""){
                    //单个信息失败
                   // $("#feedback").removeClass().addClass("Red").attr("innerHTML",msg.msg.replaceAll("\\\|","<br/>")).fadeIn("slow");

                    showFeedback(msg.msg.replaceAll("\\\|","<br/>"));
                    $("#draggable label[id^='feedback_']").removeClass().attr("innerHTML", "");
                }
            }
        },
        error : function(){
            //$("#feedback").attr("innerHTML","<strong>"+ajaxfeedback_exception+"</strong>");
            //$("#feedback").removeClass().addClass("Red").fadeIn("slow");
              showFeedback(ajaxfeedback_exception);
        }
    });
}


 $(document).ready(function(){

    $(".modify").bind("click", showDetailWindow);
    $(".delete").bind("click", delInfo);
    $("#save").bind("click", save);
});
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

相关推荐