CFGRID - 替换多列上的数据存储或过滤器

发布于 2024-09-01 09:10:15 字数 461 浏览 3 评论 0原文

ColdFusion 8

我有一个基于查询的 cfgrid。它没有绑定到 cfc 函数,因为我想要一个滚动网格,而不是分页网格(如果使用 BIND,则必须提供页码和页面大小)。我可以弄清楚如何使用它来过滤一列下面的代码,但我确实需要过滤三列...

grid.getDataSource().filter("OT_MILESTONE",t1);

在过滤字符串中添加更多内容并不能解决问题。 ..它忽略第一对值以外的任何内容..

所以..我想如果我调用一个传递三个值并将查询结果返回给我的函数,我可以替换网格的数据存储..但是我无法找出替换它的语法。

查询返回的变量具有以下格式:

{"COLUMNS":["SEQ_KEY","ID","OT_MILESTONE"],"DATA":[[63677,"x","y"]]} 

有什么想法吗?

ColdFusion 8

I have a cfgrid that that is based on a query. It is not bound to a cfc function because I want a scrolling grid, not a paged grid (you must supply the page number and page size if you use BIND).. I can figure out how to make it filter on one column by using the following code, but I really need to filter on three columns...

grid.getDataSource().filter("OT_MILESTONE",t1);

Adding more to the filter string does not do the trick...it ignores anything more than the first pair of values..

so..I thought if I called a function that passes the three values and returned the query results to me, I could replace the Data Store for the grid..but I cannot figure out the syntax to get it to replace.

The returned variable for the query has the following format:

{"COLUMNS":["SEQ_KEY","ID","OT_MILESTONE"],"DATA":[[63677,"x","y"]]} 

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

誰ツ都不明白 2024-09-08 09:10:15

经过大量的血、汗、泪水和咒骂......这就是答案,以防其他人可能需要通过多个变量过滤 cfgrid:

            var w1 = ColdFusion.getElementValue('wbs');
            var t1 = ColdFusion.getElementValue('task');    
            var p1 = ColdFusion.getElementValue('project');

            grid = ColdFusion.Grid.getGridObject('data');
            store = grid.getDataSource();
            store.clearFilter();
            store.filterBy(function myfilter(record) {
                    var wantit = true;
                        if (trim(w1) != '') {
                            if(record.get('WBS_ID') != w1) {
                                wantit = false;
                        }}
                        if (trim(t1) != '') {
                            if(record.get('OT_MILESTONE') != t1) {
                                wantit = false;
                        }}
                        if (trim(p1) != '') {
                            if(record.get('PROJECT') != p1) {
                                wantit = false;
                        }}

                    return wantit;
                });

            ColdFusion.Grid.refresh('data',false); 

你将需要一个 JS 修剪功能......

确保列名是大写的...... 。

after much blood, sweat, tears and swearing..here's the answer, in case anyone else might need to filter a cfgrid by more than one variable:

            var w1 = ColdFusion.getElementValue('wbs');
            var t1 = ColdFusion.getElementValue('task');    
            var p1 = ColdFusion.getElementValue('project');

            grid = ColdFusion.Grid.getGridObject('data');
            store = grid.getDataSource();
            store.clearFilter();
            store.filterBy(function myfilter(record) {
                    var wantit = true;
                        if (trim(w1) != '') {
                            if(record.get('WBS_ID') != w1) {
                                wantit = false;
                        }}
                        if (trim(t1) != '') {
                            if(record.get('OT_MILESTONE') != t1) {
                                wantit = false;
                        }}
                        if (trim(p1) != '') {
                            if(record.get('PROJECT') != p1) {
                                wantit = false;
                        }}

                    return wantit;
                });

            ColdFusion.Grid.refresh('data',false); 

you will need a JS trim function...

Make sure the column names are caps...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文