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 - tbum

Pages: [1]
1
Hello, I'm tbum,

I use treeModel to represent the grid.
When I did addNode, I temporarily set the id value to "pq_tmp_~~~".
And after saving is complete.
grid.commit(type:'add',rows:~~);
and the commit worked fine.

but
If addNode is executed once more
When the getChanges function is executed, it tries to save 2 rows including the row saved before addList.
So I ran grid.commit() // no args .

I wonder if writing the code as above is correct programming.

Currently I am using paramquery 8.x. I wonder if it's because of that.

And after I addNode and save. When I tried to add one more node to the just-added node, it was added to the last row of the entire grid, so when I checked it in debug mode, I found that the id of the previously created node was still "pq_tmp_~~~" in the cache.

How can I update both cache and dataModel.data after save?



Quote

const saveChanges = async () => {
  //attempt to save editing cell.
  // debugger;
  if (grid.saveEditCell() === false) {
    return false;
  }
  const orderChanged = setOrderChanges();
  const parentChanged = setParentChanges();
  let isChanged = false;
  if (orderChanged.length > 0) {
    isChanged = true;
  }

  if (grid.isDirty() && grid.isValidChange({ focusInvalid: true }).valid) {
    isChanged = true;
    var changes = grid.getChanges({ format: 'raw' });
    console.log(changes);

    // console.log(parentChanged);

    legendData = await request.finances.post('/budgetAccount/saveItem', changes);
    // console.log(legendData);
    // return;
    Object.keys(legendData).map(key => {
      let data = legendData[key];
      if (key === 'add') {
        data.map(item => {
          const rowIndx = item.pq_ri;
          grid.removeClass({
            rowIndx: rowIndx,
            cls: 'new-row',
          });
          // item.budgetIdx = item.budgetIdx.toString();

          grid.updateRow({
            rowIndx: rowIndx,
            newRow: {
              budgetIdx: item.budgetIdx,
              budgetCode: item.budgetCode,
              displayCode: item.displayCode,
            },
            checkEditable: false,
            history: false,
            track: true,
          });
          return {
            budgetIdx: item.budgetIdx,
          };
        });

        console.log(data);

// If the rows value is not entered, the budgetIdx value appears to have been updated in tmp, but it is not actually updated.
        // So after saving, if you try to add a node as a child node of that node, it's like trying to reference a parentId that doesn't exist.
        // misbehavior.
        grid.commit({
          type: key,
          rows: data,
        });

// However, in this case, there is a problem that children such as pq_tmp_0.234234 remain uncommitted. If you call the getChanges function
        // Trying to save one more time, data increases exponentially.
        // Commit one more time to empty.
        grid.commit({
          type: key,
        });
      } else {
        grid.commit({
          type: key,
          rows: data,
        });
      }
    });
  }

2
By setting the historyMove value to true in treeModel, changes in the order of nodes are also saved in history.
However, nothing changed when I called grid.getChanges . How do I know which nodes have changed their order?

3
How can I express rows fixed to the first line always without being affected by sorting?
I implemented summary at the bottom. Therefore, one row is fixed for each of the top and bottom.

5
How can I access the dom object for the grid-overay of the selectionModel?
I want to set different colors depending on the selected area position.

6
Help for ParamQuery Pro / about selectionModel's block
« on: June 30, 2022, 02:12:46 pm »
Code: [Select]

            selectionModel: {type: 'cell', mode: 'block', row: true, toggle: true,},

I have specified selectionModel as above.
What I want to do is make a block so that only cells in the same row as the cell that started the first selection are selected.
What can I do?
And no event handlers like beforeSelectChange ? This is to be able to invalidate when an unwanted area is selected.


The exact function I want to make is that I want the selectModel to work only for a specific area. Do you offer such a feature as an option?
Otherwise, I tried to develop it using an event handler.

7
I solved it! thanks for your reply :)

8
Hi,
I want to export only selected(cb: checked) rows to excel.

This works fine. However, after exporting data, it moves to page 1.
How can I avoid moving pages?

Code: [Select]
colModel: [
        { dataIndx: "selectRow", maxWidth: 30, minWidth: 30, align: "center", resizable: false,
          title: "",
          menuIcon: false,
          type: 'checkbox',
          sortable: false,
          editor: false,
          dataType: 'bool',
          copy: false,
          cb: {
            all: false,
            header: true
          }
        },
       ...
      ],
selectionModel: { type: 'row' },
toolbar: {
        items: [
          {
            type: "button",
            label: 'export',
            cls: 'btn btn-success my-1',
            listener: function () {
              let dateStr = $.datepicker.formatDate('yymmdd', new Date());
              let format = 'xlsx';

              if( this.Checkbox('selectRow').getCheckedNodes().length >= 1 ) { //If checked, export selected rows.
                this.filter({
                  oper: 'replace',
                  rules: [{ dataIndx: "selectRow", condition: "equal", value: true}]
                });
              }

              let blob = this.exportData({
                sheetName: dateStr,
                format: format,
                render: false
              });
              if(typeof blob === "string"){
                blob = new Blob([blob]);
              }
              this.filter({
                oper: 'replace',
                rules: [],
              });
              saveAs(blob, `${dateStr}.${format}`);
            }
          }
        ]
      }

9
I have two questions. Please help.

First, when exporting tree to excel, a '-' character is appended.
Can you change this character to another character?

The second is to create a function that expands only to level 2 nodes among all nodes in the tree and collapses below that level. Which method is the best way? Wouldn't it be better to collapse all nodes and then use expandTo to show level 2?


Code: [Select]

  datagrid = this.getData();
                            var target = 2;
                            var targetLevel = target -1;
                            var targetItem = [];
                            $.each(datagrid,function(i,v){
                                if(targetLevel > v.pq_level){
                                    targetItem.push(v);
                                }
                            });


                            var tree = this.Tree();
                            tree.collapseAll();
                            if(targetItem.length > 0){
                                tree.expandNodes(targetItem);
                            }

10
ParamQuery Pro Evaluation Support / Re: Paramquery Pro License registration
« on: September 18, 2021, 09:12:36 am »
Thanks !
Hi Taebum Um

Your account has been upgraded to Pro Ultimate.

Regards
Paramvir

11
ParamQuery Pro Evaluation Support / Paramquery Pro License registration
« on: September 18, 2021, 07:19:10 am »
Hello,

We purchased a ParamQuery Pro License for my company use, please upgrade this account to pro with:

Transaction ID: XXXXXXXXXXX005825R

Thanks!

Pages: [1]