


<script> <P>$(document).ready(function()<BR>{<BR> initPlsfList();<BR>});<BR>//初始化grid列表<BR>function initPlsfList(){<BR> //缓存表列数组,key 为页面元素的name ,value 对应数据库中的字段<BR> var cellArray = new Array();<BR> cellArray["zoneID"] ="ZONE_ID"; <BR> cellArray["factorPG"] ="FACTOR_PG"; <BR> cellArray["factorQG"] ="FACTOR_QG";<BR> cellArray["factorPL"] ="FACTOR_PL";<BR> cellArray["factorQL"] ="FACTOR_QL";<BR> cellArray["valid"] ="VALID";<BR> <P> var caseID = '${caseID}';<BR> $("#plsfList").jqGrid({<BR> url:"<c:url value='/lfc/powerlsfactor/queryData?caseID=" caseID "' />",<BR> datatype: "json",<BR> mtype:"POST",<BR> height: "auto",<BR> width: "auto",<BR> colNames:[<BR> 'id',<BR> "<fmt:message key='case.valid'/>", <BR> "<fmt:message key='zone'/>", <BR> "<fmt:message key='pasf'/>", <BR> "<fmt:message key='pisf'/>",<BR> "<fmt:message key='lasf'/>",<BR> "<fmt:message key='lisf'/>",<BR> 'modeID'<BR> ],<BR> colModel:[<BR> {name:'id',index:'id', width:100,hidden:true},<BR> {name:'valid',index:'valid', width:100,editable:true,<BR> formatter:formatValid,<BR> editable:true,edittype:'checkbox',<BR> editoptions:{value:'1:0',defaultValue:'1'}<BR> },<BR> {name:'zoneName',index:'zoneName', width:150,editable:true},<BR> {name:'factorPG',index:'factorPG', width:100,editable:true},<BR> {name:'factorQG',index:'factorQG', width:100,editable:true},<BR> {name:'factorPL',index:'factorPL', width:100,editable:true},<BR> {name:'factorQL',index:'factorQL', width:100,editable:true},<BR> {name:'caseID',index:'caseID', width:100,hidden:true},<BR> ],<BR> rowNum:10,<BR> rowList:[10,20,30],<BR> pager: '',<BR> cellEdit:true,<BR> viewrecords: true,<BR> jsonReader: { repeatitems : false, id: "id" },<BR> viewsortcols:[false,'horizontal',false],<BR> sortable:false,<BR> sortorder:"asc",<BR> sortname:"id",<BR> multiselect: true,<BR> cellurl:"<c:url value='/lfc/powerlsfactor/save'/>",<BR> cellsubmit: 'remote',<BR> gridComplete: function() {<BR> var $selecAll = $("#cb_plsfList");<BR> var cb_title = "<fmt:message key='select.all' bundle='${commonResources}'/>" ;<BR> if($selecAll){<BR> $selecAll.attr("title",cb_title);<BR> }<BR> //设置全选checkbox title<BR> var rowIds = jQuery("#plsfList").jqGrid('getDataIDs');<BR> for(var k=0; k<rowIds.length; k++) {<BR> var curRowData = jQuery("#plsfList").jqGrid('getRowData', rowIds[k]);<BR> var curChk = $("#"+rowIds[k]+"").find(":checkbox");<BR> //curChk.attr('title', curRowData.modeName); //给checkbox赋予额外的属性值<BR> }<br><br> },<BR> onSortCol:function(index,iCol,sortorder){<BR> return false ;<BR> },<BR> ondblClickRow: function (rowid,iRow,iCol,e) {<BR> /*var $plsfList = $("#plsfList");<BR> if (isRowNeedSave($plsfList)){<BR> showMessage("请先保存");<BR> }else{<BR> $("#operate").val("update");<BR> newrowid = rowid ;<BR> $plsfList.setGridParam({cellEdit:false});<BR> $plsfList.jqGrid('editRow', rowid, true);<BR> //确定按钮可用<BR> $("#confirm_btn").attr("disabled",false);<br><br> }*/<BR> },<BR> beforeSubmitCell:function(rowid, cellname, value, iRow, iCol){<BR> //列提交前的拦截方法<BR> var $plsfList = $("#plsfList") ;<BR> var $editUrl = '<c:url value='/lfc/powerlsfactor/save'/>' ;<BR> //设置列提交的url。updateCellName:要编辑的列名 ;updateCellValue :是编辑的值<BR> $editUrl = addParamToUrl($editUrl,'updateCellName',iCol == 3 ? cellArray['zoneID'] :cellArray[cellname]);<BR> $editUrl = addParamToUrl($editUrl,'updateCellValue',iCol == 3 ? $("#zone_id").val():value);<BR> //给jqgrid 从新设置cellurl 值<BR> $plsfList.setGridParam({cellurl:$editUrl});<BR> return false ;<BR> },<BR> afterEditCell:function(rowid, cellname, value, iRow, iCol){<BR> //动态修改lie时,当列 变为可修改状态时,给列add一个button,且列中元素不可编辑,点击button 弹出一个模态窗口,可以选择元素 ,赋值给grid当前编辑列中单行表单域中.<BR> $("#"+rowid+" input[type='checkbox']").attr("checked",value == "<fmt:message key='case.valid'/>" ? true:false);<BR> if(iCol==3){<BR> $("#irowNum").val(rowid);<BR> var $data = $("#"+rowid +">td"); //获取这个行里所有的td元素,即:获取所有子元素<BR> $zoneInput = $data.find("input").eq("1") ;<BR> $zoneInput.css("width","100px");<BR> $zoneInput.attr("disabled",true);<BR> $zoneInput.after("<input type='button' value='选择' onclick='fnCallDialogForEidt()' />");<BR> }<BR> }<P> }); <P><BR>//Add a new row to grid<BR>var newrowid;<BR>function addRow()<BR>{<BR> $("#operate").val("");<BR> var selectedId = $("#plsfList").jqGrid("getGridParam", "selrow"); <BR> var ids = jQuery("#plsfList").jqGrid('getDataIDs');<BR> //Get the current Maximum row number (data number) <BR> var rowid = Math.max.apply(Math,ids); <BR> //Get the row number (data number) of the newly added row <BR> newrowid = rowid 1;<BR> var dataRow = { <BR> id: "",<BR> valid:"",<BR> zoneID:'',<BR> factorPG:'',<BR> factorQG:'',<BR> factorPL: '',<BR> factorQL:'',<BR> caseID:''<BR> }; <br><br> //Insert the newly added row into the first column <BR> $("#plsfList" ).jqGrid("addRowData", newrowid, dataRow, "first");<BR> //Set grid cells to be non-editable<BR> $("#plsfList").setGridParam({cellEdit:false});<BR> //Set grid cells to be editable<BR> $('#plsfList').jqGrid('editRow', newrowid, false);<BR> //Confirm button is available<BR> $("#confirm_btn"). attr("disabled",false);<BR> //Add a selection button to the added column<BR> var $zoneInput = $("#" newrowid "_zoneName");<BR> $zoneInput.attr("disabled" ,true).css("width",100);<BR> $zoneInput.after("<input type='button' value='select' onclick='fnCallDialogForEidt()' />");<br><br>} <P><BR>function insertPlsf(){<BR> var $plsfList = $("#plsfList") ;<BR> var $operate = $("#operate").val();<BR> // Set grid cells to be editable<BR> $plsfList.setGridParam({cellEdit:true});<BR> //Set grid rows to be uneditable<BR> //$plsfList.jqGrid('editRow', newrowid, false); <BR> //URL of splicing request<BR> var url = '<%=basePath%>' "/lfc/powerlsfactor/save" ;<BR> var $params = $plsfList.find("input[id ^=" newrowid "]");<BR> var $check_val = $params.eq(0).is(':checked') ? 1:0;<BR> url = addParamToUrl(url,'valid',$ check_val);<BR> url = addParamToUrl(url,'zoneID',$("#zone_id").val());<BR> url = addParamToUrl(url,'factorPG',$params.eq(2). val());<BR> url = addParamToUrl(url,'factorQG',$params.eq(3).val());<BR> url = addParamToUrl(url,'factorPL',$params.eq(4 ).val());<BR> url = addParamToUrl(url,'factorQL',$params.eq(5).val());<br><br> var $caseID = $("#caseID") .val();<BR> url = addParamToUrl(url,'caseID',$caseID); <P> $.ajax({url:url,type:"post",timeout:5000, <BR> success:function(data){<BR> showMessage(data);<BR> reloadGrid();<BR> }<BR> });<BR> //The newly added line number will initially be empty<BR> newrowid = '' ;<BR> //The confirmation button is unavailable<BR> $("#confirm_btn").attr( "disabled",true);<BR>} <P><BR>//Format zone column output content<BR>function formatZone(cellvalue, options, rowObject){<BR> if(cellvalue == 0){<BR> return 0;<BR> }else if( cellvalue == 1){<BR> return 1;<BR> }else if(cellvalue == 2){<BR> return 2;<BR> }else{<BR> return 3;<BR> }<BR> } <P><BR>function isRowNeedSave($jqgrid){<BR> var $editTr = $jqgrid.find("tr[editable=1]") ;<BR> var flag = false ;<BR> if ( $editTr && $editTr.length > 0){<BR> flag = true ;<BR> }<BR> return flag ;<BR>} <P><BR>function cancel(){<BR> reloadGrid();<BR> //Confirm button is not available<BR> $("#confirm_btn").attr("disabled",true);<BR> //Set grid cells to be editable<BR> $("#plsfList").setGridParam({cellEdit:true});<BR> //Set grid cells to be editable<BR> $('#plsfList'). jqGrid('editRow', newrowid, true);<BR>} <P> <P>function fnCallDialogForEidt(){<BR> //Get the current line number (data number) <BR> var returnValue = "";<BR> returnValue = window.showModalDialog("<c:url value='/element /zone/query?caseID=" $("#caseID").val() "' />",window,"");<BR> if(returnValue==""||returnValue==null)<BR> return;<BR> var $plsfList = $("#plsfList");<BR> var $params = $plsfList.find("input[id$='zoneName']");<BR> var names = returnValue.split(",");<BR> $params.eq(0).val(names[1]);<BR> $("#zone_id").val(names[0]);<BR> }<BR></script>



Detailed explanation of JavaScript string replacement method and FAQ This article will explore two ways to replace string characters in JavaScript: internal JavaScript code and internal HTML for web pages. Replace string inside JavaScript code The most direct way is to use the replace() method: str = str.replace("find","replace"); This method replaces only the first match. To replace all matches, use a regular expression and add the global flag g: str = str.replace(/fi

So here you are, ready to learn all about this thing called AJAX. But, what exactly is it? The term AJAX refers to a loose grouping of technologies that are used to create dynamic, interactive web content. The term AJAX, originally coined by Jesse J

10 fun jQuery game plugins to make your website more attractive and enhance user stickiness! While Flash is still the best software for developing casual web games, jQuery can also create surprising effects, and while not comparable to pure action Flash games, in some cases you can also have unexpected fun in your browser. jQuery tic toe game The "Hello world" of game programming now has a jQuery version. Source code jQuery Crazy Word Composition Game This is a fill-in-the-blank game, and it can produce some weird results due to not knowing the context of the word. Source code jQuery mine sweeping game

Article discusses creating, publishing, and maintaining JavaScript libraries, focusing on planning, development, testing, documentation, and promotion strategies.

This tutorial demonstrates how to create a captivating parallax background effect using jQuery. We'll build a header banner with layered images that create a stunning visual depth. The updated plugin works with jQuery 1.6.4 and later. Download the

The article discusses strategies for optimizing JavaScript performance in browsers, focusing on reducing execution time and minimizing impact on page load speed.

Matter.js is a 2D rigid body physics engine written in JavaScript. This library can help you easily simulate 2D physics in your browser. It provides many features, such as the ability to create rigid bodies and assign physical properties such as mass, area, or density. You can also simulate different types of collisions and forces, such as gravity friction. Matter.js supports all mainstream browsers. Additionally, it is suitable for mobile devices as it detects touches and is responsive. All of these features make it worth your time to learn how to use the engine, as this makes it easy to create a physics-based 2D game or simulation. In this tutorial, I will cover the basics of this library, including its installation and usage, and provide a

This article demonstrates how to automatically refresh a div's content every 5 seconds using jQuery and AJAX. The example fetches and displays the latest blog posts from an RSS feed, along with the last refresh timestamp. A loading image is optiona


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver Mac version
Visual web development tools