Example code for moving js table rows up and down
<script type="text/javascript"> function tagPosition() { $('#easyTables').tabs('select', '输出方式'); var rows = $('#dgTag').datagrid('getRows');//获取当前页的数据行 //var ary = new Array(); var ary = ""; for (var i = 0; i < rows.length; i++) { ary += rows[i]['id']+","; } ary=ary.substring(0,ary.length-1); $.ajax({ url:'../../modelFilter/Position', type:'POST', data:{"ary" : ary}, success: function(result){ console.log(ary); } }); } //上移动 function datagridRowMove( isUp) { var rows=$('#dgTag').datagrid('getRows'); var rowlength=rows.length; var selectrow=$('#dgTag').datagrid('getSelected'); var rowIndex=$('#dgTag').datagrid('getRowIndex', selectrow); if(rowIndex==0){ $.messager.alert('提示', '顶行无法上移!', 'warning'); }else{ $('#dgTag').datagrid('deleteRow', rowIndex);//删除一行 rowIndex--; $('#dgTag').datagrid('insertRow', { index:rowIndex, row:selectrow }); $('#dgTag').datagrid('selectRow', rowIndex); } } //下移动 function datagridRowMove1( isUp) { var rows=$('#dgTag').datagrid('getRows'); var rowlength=rows.length; var selectrow=$('#dgTag').datagrid('getSelected'); var rowIndex=$('#dgTag').datagrid('getRowIndex', selectrow); $('#dgTag').datagrid('deleteRow', rowIndex);//删除一行 rowIndex++; $('#dgTag').datagrid('insertRow', { index:rowIndex, row:selectrow }); $('#dgTag').datagrid('selectRow', rowIndex); if(rowIndex>=rowlength){ $.messager.alert('提示', '最后一行无法下移!', 'warning'); } } </script>
添加onclick="tagPosition()" 后台保存移动后数据
@RequestMapping(value = "/Position", method = RequestMethod.POST) @ResponseBody public void position(String ary){ if (ary !=null && !ary.equals("")) { ModelTag model = new ModelTag(); String[] arr = ary.split(","); try { for (int i = 0; i < arr.length; i++) { model.setId(Integer.parseInt(arr[i])); model.setTagPosition(i + 1); modelFilterManager.updataTagEncryption(model); } /*model.setId(9600); model.setModuleId("2017021316419558"); model.setTagPosition(1); modelFilterManager.updataTagEncryption(model);*/ System.out.println("controller " + ary); } catch (Exception e) { e.printStackTrace(); } } }
The above is the detailed content of Example code for moving js table rows up and down. For more information, please follow other related articles on the PHP Chinese website!

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



1. Create a new PPT file and name it [PPT Tips] as an example. 2. Double-click [PPT Tips] to open the PPT file. 3. Insert a table with two rows and two columns as an example. 4. Double-click on the border of the table, and the [Design] option will appear on the upper toolbar. 5. Click the [Shading] option and click [Picture]. 6. Click [Picture] to pop up the fill options dialog box with the picture as the background. 7. Find the tray you want to insert in the directory and click OK to insert the picture. 8. Right-click on the table box to bring up the settings dialog box. 9. Click [Format Cells] and check [Tile images as shading]. 10. Set [Center], [Mirror] and other functions you need, and click OK. Note: The default is for pictures to be filled in the table

Can the appdata folder be moved to the D drive? With the increasing popularity of computer use, more and more users' personal data and applications are stored on the computer. In Windows operating system, there is a specific folder called appdata folder, which is used to store user's application data. Many users wonder whether this folder can be moved to the D drive or other disks for data management and security considerations. In this article, we will discuss this problem and provide some solutions. First, let me

Being able to skillfully make forms is not only a necessary skill for accounting, human resources, and finance. For many sales staff, learning to make forms is also very important. Because the data related to sales is very large and complex, and it cannot be simply recorded in a document to explain the problem. In order to enable more sales staff to be proficient in using Excel to make tables, the editor will introduce the table making issues about sales forecasting. Friends in need should not miss it! 1. Open [Sales Forecast and Target Setting], xlsm, to analyze the data stored in each table. 2. Create a new [Blank Worksheet], select [Cell], and enter [Label Information]. [Drag] downward and [Fill] the month. Enter [Other] data and click [

1. Open the worksheet and find the [Start]-[Conditional Formatting] button. 2. Click Column Selection and select the column to which conditional formatting will be added. 3. Click the [Conditional Formatting] button to bring up the option menu. 4. Select [Highlight conditional rules]-[Between]. 5. Fill in the rules: 20, 24, dark green text with dark fill color. 6. After confirmation, the data in the selected column will be colored with corresponding numbers, text, and cell boxes according to the settings. 7. Conditional rules without conflicts can be added repeatedly, but for conflicting rules WPS will replace the previously established conditional rules with the last added rule. 8. Repeatedly add the cell columns after [Between] rules 20-24 and [Less than] 20. 9. If you need to change the rules, you can just clear the rules and then reset the rules.

According to news on July 23, blogger Digital Chat Station broke the news that the battery capacity of Xiaomi 15 Pro has been increased to 6000mAh and supports 90W wired flash charging. This will be the Pro model with the largest battery in Xiaomi’s digital series. Digital Chat Station previously revealed that the battery of Xiaomi 15Pro has ultra-high energy density and the silicon content is much higher than that of competing products. After silicon-based batteries are tested on a large scale in 2023, second-generation silicon anode batteries have been identified as the future development direction of the industry. This year will usher in the peak of direct competition. 1. The theoretical gram capacity of silicon can reach 4200mAh/g, which is more than 10 times the gram capacity of graphite (the theoretical gram capacity of graphite is 372mAh/g). For the negative electrode, the capacity when the lithium ion insertion amount reaches the maximum is the theoretical gram capacity, which means that under the same weight

Microsoft changed the name of PhoneLink to MobileDevice in the latest Windows 11 version. This change allows users to control computer access to mobile devices through prompts. This article explains how to manage settings on your computer that allow or deny access from mobile devices. This feature allows you to configure your mobile device and connect it to your computer to send and receive text messages, control mobile applications, view contacts, make phone calls, view galleries, and more. Is it a good idea to connect your phone to your PC? Connecting your phone to your Windows PC is a convenient option, making it easy to transfer functions and media. This is useful for those who need to use their computer when their mobile device is unavailable

Sometimes, we often encounter counting problems in Word tables. Generally, when encountering such problems, most students will copy the Word table to Excel for calculation; some students will silently pick up the calculator. Calculate. Is there a quick way to calculate it? Of course there is, in fact the sum can also be calculated in Word. So, do you know how to do it? Today, let’s take a look together! Without further ado, friends in need should quickly collect it! Step details: 1. First, we open the Word software on the computer and open the document that needs to be processed. (As shown in the picture) 2. Next, we position the cursor on the cell where the summed value is located (as shown in the picture); then, we click [Menu Bar

Word software is indispensable to us and needs to be used frequently. I have learned how to edit tables using Word software before. However, if I accidentally edit the table in the horizontal and vertical directions, and I don’t want to waste time re-creating it, is it possible to change the horizontal and vertical directions of the table? Woolen cloth? The answer is of course yes. Next, the editor will introduce to you in detail how to swap tables horizontally and vertically in Word. Let us learn together. First, we need to swap the rows and columns of the Word table below. To do this, we need to first select the table entirely, then right-click and select the copy function. Step 2: After selecting copy, we minimize word, then open an Excel table, right-click, select paste, and paste it into Exc
