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 - 杨万里

Pages: [1] 2
1
How do I add the title to the first row of exported excel?And does not affect the original cell merge.Thank you.

2
When I loaded 12,000 data, 120 columns, a total of 1.5 million cells, my browser crashed.Is there any way to improve efficiency and reduce the rendering of tables?Think you.

3
filterModel.hideRows feature is available since v6.2.4. Which version of grid are you using?

However, when I hide the rows, I use filtering, which will filter out the hidden rows as well. Could you please tell me how to solve this problem?

4
How do I add the title to the first row of exported excel?And does not affect the original cell merge.Thank you.

5
Thank you paramvir.

6
Thank you for your answer.But I used "hideRows: true" and it didn't work.I'm going to merge the first row, but when I filter it, no matter which row was filtered to the first row, it's going to merge. Is there something wrong with my code?Thank you.:)
Here is my code:
Code: [Select]
function filterhandler() {
    var $toolbar = this.toolbar(),
        $value = $toolbar.find(".filterValue"),
        value = $value.val(),
        condition = $toolbar.find(".filterCondition").val(),
        dataIndx = $toolbar.find(".filterColumn").val(),
        filterRules;

    if (dataIndx == "") {
        //search through all fields when no field selected.
        filterRules = this.getColModel().map(function(column){
            return { dataIndx: column.dataIndx, condition: condition, value: value };
        })
    }
    else {
        //search through selected field.
        filterRules = [{dataIndx: dataIndx, condition: condition, value: value}];
    }

    //call to grid filter method.
    this.filter({
        oper: 'replace',
        rules: filterRules
    });
}
//filterRender to highlight matching cell text.(optional)
function filterRender(ui) {
    var val = ui.cellData,
        filter = ui.column.filter,
        crules = (filter || {}).crules;

    if (filter && filter.on && crules && crules[0].value) {
        var condition = crules[0].condition,
            valUpper = val.toUpperCase(),
            txt = crules[0].value,
            txt = (txt == null) ? "" : txt.toString(),
            txtUpper = txt.toUpperCase(),
            indx = -1;
        if (condition == "end") {
            indx = valUpper.lastIndexOf(txtUpper);
            //if not at the end
            if (indx + txtUpper.length != valUpper.length) {
                indx = -1;
            }
        }
        else if (condition == "contain") {
            indx = valUpper.indexOf(txtUpper);
        }
        else if (condition == "begin") {
            indx = valUpper.indexOf(txtUpper);
            //if not at the beginning.
            if (indx > 0) {
                indx = -1;
            }
        }
        if (indx >= 0) {
            var txt1 = val.substring(0, indx);
            var txt2 = val.substring(indx, indx + txt.length);
            var txt3 = val.substring(indx + txt.length);
            return txt1 + "<span style='background:yellow;color:#333;'>" + txt2 + "</span>" + txt3;
        }
        else {
            return val;
        }
    }
    else {
        return val;
    }
}
obj = {
    toolbar: {
        items: [
            {
                type: 'textbox',
                label: 'Filter: ',
                attr: 'placeholder="Enter your keyword"',
                cls: "filterValue",
                listener: { keyup: filterhandler }
            },
            {
                type: 'select', cls: "filterColumn",
                listener: filterhandler,
                options: function (ui) {
                    var opts = [{ '': '[ All Fields ]'}];
                    this.getColModel().forEach(function(column){
                        var obj = {};
                        obj[column.dataIndx] = column.title;
                        opts.push(obj);
                    })
                    return opts;
                }
            },
            {
                type: 'select',
                cls: "filterCondition",
                listener: filterhandler,
                options: [
                    { "begin": "Begins With" },
                    { "contain": "Contains" },
                    { "end": "Ends With" },
                    { "notcontain": "Does not contain" },
                    { "equal": "Equal To" },
                    { "notequal": "Not Equal To" },
                    { "empty": "Empty" },
                    { "notempty": "Not Empty" },
                    { "less": "Less Than" },
                    { "great": "Great Than" },
                    { "regexp": "Regex" }
                ]
            }         
        ]
    },
    height: "100%",
    editable: true,
    sortModel: {
        on: false
    },
    columnTemplate: {render: filterRender},
    filterModel: { mode: 'OR',hideRows: true },
    // rowHt:19,
    showTitle: true,
    title: titlename,
    colModel: colModel,
    freezeCols: datast + 4,//冻结列
    numberCell: {show: false},
    autoRow: false,
    dragColumns: {enabled: false},//禁止拖动列
    mergeCells: mergeCells,
    trackModel: {on: true, dirtyClass: "pq-cell-dirty"},
    editor: {
        select: true
    },
    dataModel: {
        data: resdata,
        recIndx: 'id'
    },
    history: function (evt, ui) {
        var $grid = this.toolbar();
        if (ui.canUndo != null) {
            $("button.changes", $grid).button("option", {disabled: !ui.canUndo});
        }
        if (ui.canRedo != null) {
            $("button:contains('重做')", $grid).button("option", "disabled", !ui.canRedo);
        }
        $("button:contains('撤销')", $grid).button("option", {label: '撤销 (' + ui.num_undo + ')'});
        $("button:contains('重做')", $grid).button("option", {label: '重做 (' + ui.num_redo + ')'});
    },
    cellSave(event, ui) {
        if (ui.dataIndx.indexOf('count') > -1) {
            //console.log(ui)
            var ndataIndx = ui.dataIndx.replace(/count/, 'price');
            // console.log(ndataIndx)
            var newRow = {};
            newRow[ndataIndx] = ui.newVal * ui.rowData['matprice'];
            this.updateRow({
                rowList: [
                    {rowIndx: ui.rowIndx, newRow}
                ]
            });
        }
        $("#" + gridselector).pqGrid( "refreshView" );
    },
    rowInit: function (ui) {
        if (!ui.rowData['id']) {
            return {cls: 'fl'};
        }
    }
    }
    $("#" + gridselector).pqGrid(obj);

7
How to use filter and mergeCells at the same time?I merged the first row with mergeCells.When I use filter to do the search, when the search results to the second row, then the table will only show the second row of data, so that the second row will be merged because it becomes the first row.
https://paramquery.com/pro/demos/filter_local

8
ParamQuery Pro Evaluation Support / Re: Excel formulas can be save?
« on: November 29, 2018, 06:43:03 am »
thank you very much!

9
ParamQuery Pro Evaluation Support / Excel formulas can be save?
« on: November 22, 2018, 08:06:17 am »
when i use Excel formulas, ans save,it save it`s value not it`s formulas.how to save it`s formulas? thank you.

11
hi!
how to know the count of all rows,after  addrow?
I try to use this:
var column = $grid.pqGrid("getData", {dataIndx: ['id']});
var RowCount=column.length;
but it is not work ,RowCount is not change;

12
Hi!
Autocomplete how to Match the first character?
When I input a letter A, I match all items containing the letter a.
But I just want all line that starts with a.
Thank you!
I know I have a lot of problems, but I'm really worried. I'm very sorry.

13
Thank you for help me!
But if existing row is very many;This takes a lot of execution time.
Is there only one way?
thank you!

14
I need help,thank you.

15
Hi! :( :( :(
How to insert one row Middle of the table?
I try to use addRow to do this.
rowIndx=1
$grid.pqGrid("addRow", {rowData: rowData,rowIndx:rowIndx});
but the original  first row change.
how to insert one row like sql "insert into table where id=1";

Think you !
 

Pages: [1] 2