开发者

Using JQuery to insert new cells in a table row?

开发者 https://www.devze.com 2022-12-31 11:35 出处:网络
I know that JQuery is a very powerful library and was just wondering if it had the following capability that I really need.

I know that JQuery is a very powerful library and was just wondering if it had the following capability that I really need.

Lets say I need to insert new cells into a table row, I know how to do this basic task, but I need to insert my cells in a highly unusual way due to some of the requirements that are needed for the new cells.

I need to be able to insert cells a certain distance into the row, For example, if a row was 1000pixels wide, is there a feature in JQuery that would allow me to insert the cell 250pixels into the row and have a cell width of 50pixels and insert another cell 500pixels into the row with a cell width of 100pixels. I know how to set a cells width using JQuery, just not distance into a row.

The values wont ever be the exact same as above though because they are actually read from a database, so for example, one cell would have the fol开发者_运维百科lowing values:

CELL_01

$start=100;

$finish=150;

the above would mean a new cell is needed that needs to be inserted 100pixels into the row and has a width of 50pixels, I just cant seem to find a way to implement this feature into my application.

How could I accomplish this task?

Sorry for such a strange question, but i just cant seem to get this working.


You can emulate this by having a single column table (or the equivalent in terms of nested divs), and then use CSS relative positioning to put more divs into the rows at offsets you like.

I don't think you can do it with td, as these are bound to fixed column widths.


Don't really understand what the main question is here. But from my take of it, looks like you are trying to create a Datagrid. Since you are using JQuery I recommend take a look at this library: http://plugins.jquery.com/project/jqGrids. As for the customization of tables (as in the HTML tag), this is going to drive you nuts.


Are you looking for something like this plugin called jLayout?

0

精彩评论

暂无评论...
验证码 换一张
取 消