“冻结窗格”在表中使身体可滚动 [英] "Freeze Panes" in table to make body scrollable

查看:59
本文介绍了“冻结窗格”在表中使身体可滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个常见的要求 - 冻结窗格在一个表中,所以一些

标题行和左边的一些列被冻结,而正文内容

滚动。这使得大型桌子在屏幕上更加实用。


有许多解决方案可用。例如,
http://www.litotes .demon.co.uk / examp ... bleScroll.html


我只是想知道是否有人知道最新和最好的脚本来

解决了这个问题。

我目前的要求恰好是仅限IE6,但总是优先考虑广义

解决方案。


我喜欢上面的理查德解决方案,但像往常一样,代码是如此难以理解,以至于无法进行维护或调整。我希望看到一个技术上类似于b $ b类似的解决方案,并且编码风格更加清晰。


任何指针?


-

Matt Kruse
http://www.JavascriptToolbox .com
http://www.AjaxToolbox.com < br>

This is a common requirement - "freeze panes" in a table, so that some
header rows and some columns on the left are frozen while the body content
scrolls. This makes large tables more usable on screen.

There are a number of solutions available. For example,
http://www.litotes.demon.co.uk/examp...bleScroll.html

I''m just wondering if anyone knows of a "latest and greatest" script to
solve this problem.
My requirement at the moment happens to be IE6-only, but a generalized
solution is always preferred.

I like Richard''s solution above, but as usual the code is so unreadable that
maintenance or tweaks would be impossible. I would love to see a technically
similar solution with a more sane coding style.

Any pointers?

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com

推荐答案

" Matt Kruse" <是ne ******** @ mattkruse.com>写了
"Matt Kruse" <ne********@mattkruse.com> wrote
这是一个常见的要求 - 冻结窗格在一个表中,左边的一些
标题行和一些列被冻结,而正文内容滚动。这使得大型桌子在屏幕上更加实用。
目前我的要求恰好是IE6,但总是首选的解决方案。
This is a common requirement - "freeze panes" in a table, so that some
header rows and some columns on the left are frozen while the body content
scrolls. This makes large tables more usable on screen.
My requirement at the moment happens to be IE6-only, but a generalized
solution is always preferred.



为什么完全使用脚本?从这里链接到CSS主题的变体:

http://web.tampabay.rr.com/bmerkey/e...le-header.html


如果您的目标是IE6,那么就性能而言是最好的解决方案

和维护是CSS结合客户端数据绑定。


我同意引用的Cornford脚本。令人印象深刻但不适合正常的开发环境。此外,客户通常喜欢

数据表的良好打印版本,并且所有脚本通常都会失败。这个测试很糟糕。


Brett



Why use script at all? Links from here to variations on CSS theme:

http://web.tampabay.rr.com/bmerkey/e...le-header.html

If your target is IE6, then the very best solution in terms of performance
and maintenance is CSS combined with client-side data binding.

I agree on the cited Cornford script. Impressive but not for the normal dev
environment. In addition, clients usually like a good print version of a
data table and all scripts usually fail that test miserably.

Brett



Brett Merkey写道:
Brett Merkey wrote:
为什么要使用脚本?从这里链接到CSS主题的变体:
http://web.tampabay.rr.com/bmerkey/e...le-header.html

锁定第一列需要javascript。我看过上面的

解决方案,我自己实现了类似的东西。但我不喜欢

表达式,解决方案需要在40x250表上表现更好,对于

例子。

如果你的目标是IE6,那么在性能和维护方面最好的解决方案是CSS结合客户端数据绑定。
Why use script at all? Links from here to variations on CSS theme:
http://web.tampabay.rr.com/bmerkey/e...le-header.html
Locking the first column requires javascript. I''ve looked at the above
solution, and I''ve implemented something similar myself. But I don''t like
expressions, and the solution needs to perform better on 40x250 tables, for
example.
If your target is IE6, then the very best solution in terms of
performance and maintenance is CSS combined with client-side data
binding.




嗯,我在那里不同意。输出实际上来自java webapp,所以

客户端数据绑定根本不需要。而CSS并没有完成整个工作。 :)


-

Matt Kruse
http://www.JavascriptToolbox.com
http ://www.AjaxToolbox.com


Brett Merkey写道:
Brett Merkey wrote:
" Matt Kruse" <是ne ******** @ mattkruse.com>写了
"Matt Kruse" <ne********@mattkruse.com> wrote
这是一个常见的要求 - 冻结窗格在表格中,
以便在身体内容滚动时冻结左边的一些标题行和一些列。 ....。
This is a common requirement - "freeze panes" in a table,
so that some header rows and some columns on the left are
frozen while the body content scrolls. ... .


< snip>为什么要使用脚本呢?从这里链接到CSS主题的变体:

http://web.tampabay.rr.com/bmerkey/e...le-header.html


他们实际上并没有那么好。如果他们这样做我会说使用CSS,但是

标题在Opera 7.5中没有修复,Mozilla会弹出一个水平的

滚动条,当你滚动标题单元格时不要与水平滚动的身体细胞对齐

。 CSS对滚动条的尺寸(它们仍然是

系统默认值,即使它们是用户可配置的)和表格
$做出了无效的假设。 b $ b不能超过可用的水平空间并且水平滚动

以暴露更多的标题和数据单元格。最重要的是你不能安排单个列固定在一个水平的

滚动体旁边的CSS,更不用说修复顶行和

最左边的列。


由于我的脚本演示了所有这些事情都可以完成,可以在许多动态可视化浏览器上完成
,并且可以在不支持脚本的环境中干净地降级为

完全可用的HTML,脚本编写的原因可能是它无法单独使用CSS。


< snip>我同意引用的Cornford脚本。对于正常的开发环境来说,令人印象深刻但并非如此。


在开发环境中需要的是代码,它使用最简单的接口来指定
。因为我的脚本的整个

公共界面是一个单一的功能,所以你不能得到太多的东西。/ b
更简单。所有想要使用该脚本的人都要写的是(或者

脚本生成)一个HTML表,它符合文档中的(有限的)
限制,样式吧,为它提供一个唯一的ID

并将id作为参数传递给函数调用,并且它被设计为

for,并且适合于自动化该过程在服务器端

脚本。


编写代码供别人使用时(特别是服务器端)

程序员不知道javascript,也不想知道这是一个对象的外部视图,而不是其中的代码。

此外,客户通常喜欢数据表的良好打印版本,并且所有脚本通常都会失败。

<snip> Why use script at all? Links from here to variations on
CSS theme:

http://web.tampabay.rr.com/bmerkey/e...le-header.html

They don''t actually work that well. If they did I would say use CSS, but
the header is not fixed in Opera 7.5, Mozilla puts up a horizontal
scroll bar and when you scroll it the header cells don''t line up with
the horizontally scrolled body cells. The CSS makes an invalid
assumption about the dimensions of scroll bars (that they remain the
system defaults even though they are user configurable) and the table
cannot exceed the available horizontal space and be scrolled
horizontally to expose more headers and data cells. And above all you
cannot arrange that a single column is fixed next to a horizontally
scrolling body at all with CSS, let alone fix the top row and the
leftmost column.

As my script demonstrates that all of these things can be done, can be
done on many dynamic visual browsers, and can cleanly degrade into
entirely usable HTML in environments that do not support the script, the
reason for scripting it might be that it works where CSS alone cannot.

<snip> I agree on the cited Cornford script. Impressive but not
for the normal dev environment.
What is required in a development environment is code that does what it
was specified to do with the simplest possible interface. As the entire
public interface for my script is a single function you cannot get much
simpler. All anyone wanting to use the script has to do is write (or
script generate) an HTML table that conforms with the (limited)
restrictions in the documentation, style it, provide it with a unique ID
and pass the id as an argument to a function call, and it was designed
for, and lends itself to, having that process automated in server side
scripts.

When writing code to be used by others (and particularly server-side
programmers who don''t know javascript, and don''t want to) it is the
external view of an object that is important not the code inside it.
In addition, clients usually like a good print version
of a data table and all scripts usually fail that test
miserably.




这主要是失败理解一个CSS的重要方面

打印样式表。


Richard。



That is mostly just a failure to understand an !Important aspect of CSS
in print style sheets.

Richard.


这篇关于“冻结窗格”在表中使身体可滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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