小编Sam*_*ndy的帖子

使用jQuery UI可以与HTML表进行排序

我想在HTML表格中输出数据库中的一些数据,我希望用户能够重新排序表格行.为实现这一点,我使用jQuery UI进行排序,因此:

<script>
    $(function() {
        $( "#sortable" ).sortable();
        $( "#sortable" ).disableSelection();
    });
    </script>
<?php 
 while($row = mysql_fetch_assoc($co_authors)) {
                    echo "<tr id='sortable'><td>{$row['author_email']}</td>
                         <td>{$row['coauthor_level']}</td>";
                         <td><button class='remove' id='remove' name='remove' email="<?php echo $row['author_email'] ?>"
                            paper="<?php echo $row['paper_id'] ?>">Remove</button></td>
                         </tr>";
                }
?>
Run Code Online (Sandbox Code Playgroud)

问题是,当我拖动一个表时tr,只会td被拖动.此外,最重要的是,只有第一行是可拖动的:效果不会应用于其他行.我怎么解决这个问题?

jquery jquery-ui html-table jquery-ui-sortable

74
推荐指数
1
解决办法
10万
查看次数

限制jquery ui可移动外框边框的移动

我正在使用jquery ui draggable以使用户可拖动字段集,整个页面加载到iframe中.问题是我可以在iframe边框外面拖动字段集,我怎么能阻止它?

<iframe src='test.html'></iframe>
Run Code Online (Sandbox Code Playgroud)

的test.html

    <html>
<script>
$(".draggable").draggable();
</script>
<fieldset id='draggable'>testing</fieldset>
</html>
Run Code Online (Sandbox Code Playgroud)

iframe jquery jquery-ui jquery-ui-draggable

3
推荐指数
1
解决办法
972
查看次数

选择最近的textarea到一个按钮

我有一个td包含一个textarea和一个按钮的表,我想通过AJAX按钮点击发送textarea的值但是选择最近的textarea到按钮有问题.

JavaScript的

$(document).ready(function () {
    $(document).on("click", ".addR", function () {
        paperID = $(this).attr("paperID");
        commentID = $(this).attr("commentID");
        text = $(this).closest("textarea").val();
        $.ajax({
            data: {
                paperID: paperID,
                commentID: commentID,
                text: text
            },
            type: 'POST',
            url: 'add_rebuttal.php',
            success: function (response) {
                alert(response);
                window.location.href = window.location.href;
            }
        });
    });
});
Run Code Online (Sandbox Code Playgroud)

PHP:

while ($row = mysql_fetch_assoc($comments)) {
    echo "<tr><td>{$row['text']}</td>";
?>
    <td><br /><textarea class="reText" rows='5' name='reText' id='reText' style='width:98%;' type='text'></textarea>
    <button commentID="<?php echo $row['comment_id'] ?>" paperID="<?php echo $paper_id ?>" class="addR" type="button" name="addR" id="addR">send rebuttal</button></td></tr> …
Run Code Online (Sandbox Code Playgroud)

javascript php jquery closest

2
推荐指数
1
解决办法
684
查看次数

按钮单击显示表格

我想要做的就是在JTable用户点击一个按钮时显示一些数据并且它可以正常工作,但是会发生一些奇怪的事情.当我第一次点击按钮时没有任何反应,但是当我最大化帧时,表格出现了!

ActionListener

b2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                boolean state = external.isSelected();
                DefaultTableModel model = new DefaultTableModel(ManhattanTable(values), Headers(values));
                   JTable table = new JTable(model);
                   table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                   container.add(new JScrollPane(table));
                   table.setVisible(false);
                if(state) {
                    PrintStream out = null;
                    try {
                        out = new PrintStream(new FileOutputStream("output.txt"));
                    } catch (FileNotFoundException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                    System.setOut(out);
                    long start= System.currentTimeMillis();
                    Manhattan(values);
                    long end=System.currentTimeMillis();
                    out.println("time: "+(end-start)+" milliseconds");
                    out.println("Number of input data: "+values.size());    
                } else { …
Run Code Online (Sandbox Code Playgroud)

java user-interface swing jtable repaint

0
推荐指数
1
解决办法
1194
查看次数