Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - msdnweixiao

Pages: [1] 2
1
Help for ParamQuery Pro / Re: table auto scroll
« on: June 03, 2021, 12:13:35 pm »
Click the mouse wheel, slide the mouse, the table will automatically scroll. Click the left mouse button and the form will exit the automatic sliding state.
1. At this time, move the mouse to the header, slide the mouse left and right (not click but slide), and the table data will automatically scroll up.
2. Move the mouse to the end of the table, slide the mouse left and right, and the data of the table will automatically scroll down.
The above situation only appears in ie, other browsers have no problem.
The official case also has this problem in ie.
How to solve this problem? thank you

2
Help for ParamQuery Pro / table auto scroll
« on: May 28, 2021, 12:31:57 pm »
hello,
1. When the table has more than 1000 rows and 30 columns of data, drag the bottom scroll bar, and the page will get stuck. Can you handle this situation?
2. In some cases, the mouse wheel does not scroll, but just moves the mouse, and then the table data will move up and down. Can this be handled?

thank you。

3
Help for ParamQuery Pro / Re: paramquery memory release or destroy
« on: January 12, 2021, 03:19:58 pm »
The number of rows of the parent table and the child table is uncertain,
but it is generally no more than 200 rows, and the number of columns is about 40 columns.

Will the way I use API to load data cause memory occupation.
Then, when the pop-up window is closed, clean up the occupied memory?

thank you.

4
Help for ParamQuery Pro / Re: paramquery memory release or destroy
« on: January 12, 2021, 12:32:46 pm »
it's not worked.

Because the showModalDialog I used to open the page of paramquery,
so $("#myGrid").PqGrid (obj) before calling $("#myGrid").PqGrid ('destroy'), IE will report false: Error: cannot call methods on pqGrid prior to initialization; attempted to call method 'destroy'.
and I'll try again window.close () the method is called before, but the memory can not be released.

Is there any other good way to free memory?

Here's my code:

// public.js  Call pop-up method
var data = showModalDialog("/views/html/dj_query.html", params1, dialogStyle);

// dj_query.html
<head>
<script type="text/javascript">
        var paramsO = window.dialogArguments;
        var prevRowIdx = -1, prevCellIdx = 0;
        var subsql, gridRows = 0;
        var grid, subGrid, flds;
        var hasSub = true;
        var prevCount = 0;
        var gridHeight = 400;

        $(function () {
            // 加载方案数据
            $.ajax({
                url: '/s/form/service?service=zl_sel_data',
                type: 'POST',
                data: 'params=' + Util.toJSONString(paramsO) + "&rand=" + Math.random(),
                success: function (stru) {
                    subsql = stru.data.zcxSql;

                    // 判断是否有子查询,自动调整高度
                    subsql = subsql.trim();
                    if (subsql == '' || typeof (subsql) == 'undifined') {
                        $("#subGrid").css('display', 'none');
                        $("#myGrid").height(580);
                        gridHeight = 580;
                        hasSub = false;
                    }

                    // 初始化主表格
                    initGrid(stru);
                }
            });
        });

        function initGrid(stru) {
            var data = stru.data;

            var colModel = [];
            var tableHeaders = [];
            try {
                tableHeaders = JSON.parse(data.tableHeader);
            } catch (err) {
                console.log(data.tableHeader);
                alert('主表格表头JSON解析异常.');
                return;
            }

            for (var i = 0; i < tableHeaders.length; i++) {
                var thd = tableHeaders;

                var nhd = {};
                nhd.title = thd.caption;
                nhd.dataIndx = thd.name;
                switch (thd.dataType) {
                    case '实数':
                        nhd.dataType = 'float';
                        break;
                    case '整数':
                        nhd.dataType = 'integer';
                        break;
                    default:
                        nhd.dataType = 'string';
                }
                nhd.width = parseInt(thd.displayWidth) + 30;
                nhd.align = 'left';
                nhd.editable = false;
                if (thd.visible == 'Y') {
                    nhd.hidden = false;
                    if (prevCellIdx == 0) {
                        prevCellIdx = i;
                    }
                } else {
                    nhd.hidden = true;
                }

                colModel.push(nhd);
            }

            var tableData = [];
            try {
                tableData = JSON.parse(data.tableData);
            } catch (err) {
                console.log(data.tableData);
                alert('主表格数据JSON解析异常.');
                return;
            }
            gridRows = tableData.length;

            var obj = {
                roundCorners: false,
                height: gridHeight,
                showTitle: false,
                stripeRows: true,
                showTop: false,
                showBottom: false,
                sortable: true,
                fillHandle: '',
                selectionModel: {type: 'cell', mode: 'block'},
                scrollModel: {autoFit: false},
                virtualX: true,
                virtualY: true,
                resizable: false,
                wrap: false,
                hwrap: false,
                numberCell: {show: true, resizable: true, title: "#"},
                colModel: colModel,
                columnBorders: true,
                rowBorders: true,
                dataModel: {
                    paging: null,
                    dataType: "JSON",
                    data: tableData
                },
                selectChange: function (event, ui) {
                    if (ui.selection.getSelection().length === 0) {
                        return;
                    }

                    var rowIndx = ui.selection.getSelection()[0].rowIndx;
                    if (prevRowIdx != rowIndx) {
                        prevRowIdx = rowIndx;
                        grid.setSelection(null);
                        grid.setSelection({rowIndx: rowIndx});

                        if (!hasSub) {
                            return;
                        }

                        var selData = $("#myGrid").pqGrid("getRowData", {rowIndxPage: rowIndx});
                        if (selData != null && selData) {
                            var newsql = getSQL(selData, subsql);
                            loadSubData(newsql);
                        }
                    }
                },
                rowInit: function (ui) {
                    var rowData = ui.rowData;
                    var fcolor = rowData.FCOLOR;
                    if (!fcolor) {
                        fcolor = rowData.fcolor;
                    }
                    if (fcolor) {
                        return {style: 'color:' + fcolor.replace('1', '')};
                    }
                },
                rowDblClick: function (event, ui) {
                    var rowData = $("#myGrid").pqGrid("getRowData", {rowIndx: ui.rowIndx});
                    window.returnValue = rowData;
                    window.close();
                    return true;
                },
                cellKeyDown: function (event, ui) {
                    if (event.keyCode === 13) {
                        var rowData = $("#myGrid").pqGrid("getRowData", {rowIndx: ui.rowIndx});
                        window.returnValue = rowData;
                        window.close();
                        return true;
                    }
                }
            };

            $("#myGrid").pqGrid('destroy')
            $("#myGrid").pqGrid(obj);
            grid = $("#myGrid").pqGrid("getInstance").grid;

            if (hasSub && tableData.length > 0) {
                initSubGrid(tableData[0]);
            }
            $("#myGrid").pqGrid("setSelection", {rowIndx: 0, colIndx: prevCellIdx});
            $("#myGrid").pqGrid("setSelection", {rowIndx: 0});
        }

        function initSubGrid(hzData) {
            var newSql = getSQL(hzData, subsql);
            var params = {"sql": newSql};
            var result = WebService.call("form.loadSQLField", params);
            try {
                result = JSON.parse(result);
            } catch (err) {
                console.log(result);
                alert('子表格表头JSON解析异常.');
                return;
            }

            var subFlds = [];
            var subModel = [];
            for (var i = 0; i < result.length; i++) {
                var thd = result;

                var nhd = {};
                nhd.title = thd.displaylabel;
                nhd.dataIndx = thd.fieldname;
                switch (thd.dataType) {
                    case '实数':
                        nhd.dataType = 'float';
                        break;
                    case '整数':
                        nhd.dataType = 'integer';
                        break;
                    default:
                        nhd.dataType = 'string';
                }
                nhd.width = parseInt(thd.displaywidth) + 30;
                nhd.align = 'left';
                nhd.editable = false;
                if (thd.visible == 'Y') {
                    nhd.hidden = false;
                } else {
                    nhd.hidden = true;
                }

                subModel.push(nhd);
                subFlds.push(thd.fieldname);
            }

            flds = subFlds.join(";");

            var subObj = {
                roundCorners: false,
                height: 180,
                showTitle: false,
                stripeRows: true,
                showTop: true,
                showBottom: false,
                sortable: true,
                fillHandle: '',
                selectionModel: {type: 'cell', mode: 'block'},
                scrollModel: {autoFit: false},
                virtualX: true,
                virtualY: true,
                resizable: true,
                wrap: false,
                hwrap: false,
                collapsible: {on: false, toggle: false},
                numberCell: {show: true, resizable: true, title: "#"},
                colModel: subModel,
                columnBorders: true,
                rowBorders: true,
                rowInit: function (ui) {
                    var rowData = ui.rowData;
                    var fcolor = rowData.FCOLOR;
                    if (!fcolor) {
                        fcolor = rowData.fcolor;
                    }
                    if (fcolor) {
                        return {style: 'color:' + fcolor.replace('1', '')};
                    }
                },
                cellKeyDown: function (event, ui) {
                    if (event.keyCode === 67) {
                        var tdd = $("#subGrid").pqGrid("getCell", {rowIndx: ui.rowIndx, dataIndx: ui.dataIndx});
                        if (window.clipboardData) {
                            //清空操作系统粘贴板
                            window.clipboardData.clearData();
                            //将需要复制的内容复制到操作系统粘贴板
                            window.clipboardData.setData("Text", $(tdd).text());
                        }
                    }
                }
            };

            $("#subGrid").pqGrid(subObj);
            subGrid = $("#subGrid").pqGrid("getInstance").grid;
        }

        function loadSubData(sql) {
            subGrid.option("dataModel", {
                location: "remote",
                dataType: "JSON",
                method: "POST",
                postData: {sql: sql},
                url: '/form/servlet?s=form.scheme.dynscroll&page=false&flds=' + flds + "&t=" + new Date().getTime(),
                getData: function (dataDoc, textStatus, jqXHR) {
                    return {
                        data: dataDoc.rows,
                        totalRecords: dataDoc.total_count
                    };
                }
            });
            subGrid.refreshDataAndView()
        }

        function getSQL(data, ssql) {
            for (var key in data) {
                ssql = ssql.replace(new RegExp(":" + key, "gi"), data[key]);
            }
            return ssql;
        }

        //ESC关闭窗口
        $(document).keydown(function (event) {
            var keyCode = event.keyCode;
            if (keyCode === 27) {
                window.returnValue = false;
                self.close();
            }
        });
    </script>
</head>
<body tyle="margin:0px;padding: 0px;">
<div id="myGrid" style="height:400px;margin-top:5px;width: 99%;margin:0 auto;"></div>
<br>
<div id="subGrid" style="height:170px;width: 99%;margin:0 auto;"></div>
</body>

5
Help for ParamQuery Pro / Re: change sort type dynamically
« on: January 09, 2021, 09:00:50 am »
yes, thank you.

6
Help for ParamQuery Pro / Re: change sort type dynamically
« on: January 08, 2021, 08:04:05 am »
OK, it works.

But when sorting Chinese characters, the order of sorting is not correct. How to customize sorting rules for a column?

thank you

7
Help for ParamQuery Pro / change sort type dynamically
« on: January 07, 2021, 01:30:56 pm »
hello,
When the table is initialized, the sort type is remote.
After inserting the local data, how can I change the sort type to local?

Note: Use sort method to change sortModel options dynamically.
But the sort method does not modify the type parameter.

thank you.

8
Help for ParamQuery Pro / paramquery memory release or destroy
« on: January 06, 2021, 09:41:02 am »
hello,

our project is too laggy to call showModalDialog to open the pop-up page. Every time we open the pop-up page, we call $("#myGrid").PqGrid (obj). Once, after about fifty times, the memory footprint of IE will become very stuck, which will result in the death of web pages and slow query of popups.
Now call window.close () close the pop-up window.
Does PQ have a way to release memory or destroy it?

thank you.

9
Help for ParamQuery Pro / How to adapt the meter head
« on: December 14, 2020, 08:08:34 am »
When initializing, the width of the header is set, but some headers will hide some text, so how to display all the text in the header during initialization (do not wrap).

The effect is the same as double clicking the area between two headers

thank you.

10
Help for ParamQuery Pro / switch tab, the grid become blank
« on: December 11, 2020, 01:48:38 pm »
Our project uses the internal tab page and iframe layout.
When the grid in tab1 exceeds 1000, position the mouse on line 220. Switch to TAB2. There are also grids in it, which are more than 1000. Once again, position the mouse on line 300.
When you switch to tab1, the grid in tab1 will be blank. If you scroll the mouse, the previous data will appear, but the first row has been located.
When you go back to TAB2, the same thing happens. The grid inside is blank. If you scroll the mouse, the previous data will appear, but the first row has been located.

However, if there are only 10 pieces of data in the grid, the above situation will not appear.

Therefore, I think it has something to do with the number of items displayed in the grid. When the number of items is too large, the grid will not load in.
It doesn't matter in my IE browser, but it will happen in the IE browser of other colleagues.

Is my judgment correct? So how to solve this problem?
thank you. The screenshot in the attachment,

11
Help for ParamQuery Pro / Re: how to set multiple cell border color
« on: December 07, 2020, 07:00:03 am »
i use it ,but it not worked.

i want to set the border of selection, not the border of all cells in selected area;

12
Help for ParamQuery Pro / how to Put the scroll bar under the summary row
« on: December 05, 2020, 07:25:05 am »
how to Put the scroll bar under the summary row??
thank you.


13
Help for ParamQuery Pro / how to set multiple cell border color
« on: December 02, 2020, 11:04:51 am »
when i selected multiple cell, then how to change border's color ?

not the cell color , is the selected area's border color.

thank you.

14
Help for ParamQuery Pro / Re: how to remove all rows?
« on: November 18, 2020, 11:18:31 am »
thank you.

15
Help for ParamQuery Pro / how to remove all rows?
« on: November 18, 2020, 07:21:02 am »
i can't find the api of remove grid's all rows.  thank you.
or  how to get all rows of grid?

Pages: [1] 2