使用jquery将每行表1列转换为每行表2列 [英] Make a 1 columns per row table into 2 columns per row table using jquery

查看:114
本文介绍了使用jquery将每行表1列转换为每行表2列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题.

我有一个表,将输出显示为

I have a table that will show the output as

User1
User2
User3
User4

......

那将有很多行.

现在这是某些控件的输出

Now this is the output of some control

我想将数据显示为

User1   User3
User2   User4

OR

User1   User2
User3   User4

所以我的表被拆分为显示两列,尽管其中一列.

So my table is split to show two columns in-spite of one.

我正在尝试使用jquery的after方法,但没有成功.

I am trying to use some after method of jquery but no sucess.

该表没有标题.

感谢您的帮助.

编辑

整个html是由asp.net网格视图生成的输出.

The whole html is a output that was generated by asp.net grid view.

由于网格视图支持分页,因此我选择使用gridview,然后根据需求将其拆分.

Since grid view supports paging so i go with gridview and then as per the reuirement i want to split it.

推荐答案

最后,我使用以下方法解决了我的问题:

Finally I solved my problem using:

$(document).ready(
    function () {


        for (var i = 0; i <= $('.grid tr').length - 3; i = i + 2) {
            $('.grid tr').eq(i).append($('.grid tr').eq(i + 1).html());
            $('.grid tr').eq(i + 1).hide();
        }
    }
);

这篇关于使用jquery将每行表1列转换为每行表2列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆