Author Topic: Reset button deleting last record from grid -need help  (Read 2209 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Reset button deleting last record from grid -need help
« on: September 30, 2017, 03:32:14 pm »
Hi Support team,

I am facing the below issue in Paramquery grid -

1. How to stop summary row to edit.
I have added below code on each year column and it's working fine and the same code is not working on text/select column like project

summary: {           type: "all", //use custom aggregate.
                                edit: false
                            }

2. reset button is not working - when I am resetting the grid after any changes it's deleting the last record from grid I have used following code
    grid.rollback();
    grid.history({ method: 'resetUndo' });

3. How can I create delete buttons in each item row row except the summary row.

Please see the attachment for more information.




paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Reset button deleting last record from grid -need help
« Reply #1 on: October 02, 2017, 10:13:56 am »
1. Editability of summary field can be controlled by

groupModel.summaryEdit

https://paramquery.com/pro/api#option-groupModel

and column.summary.edit

https://paramquery.com/pro/api#option-column-summary


2 & 3. grouping is a projection of data in the grid. Batch editing and grouping shouldn't be mixed. So toggle button can be used to turn off grouping when the user wants to make data changes in grid and turned back on when done with changes.
« Last Edit: October 02, 2017, 10:18:34 am by paramquery »

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Reset button deleting last record from grid -need help
« Reply #2 on: October 02, 2017, 04:38:48 pm »
I have added the summaryEdit:false, in group model but still not working for two select columns .
See the attached screenshot.

Also I don't want to add toggle option is that possible to add delete button only in item row not the summary row.
« Last Edit: October 02, 2017, 05:14:05 pm by pankajs »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Reset button deleting last record from grid -need help
« Reply #3 on: October 02, 2017, 10:57:35 pm »
The whole summary row can be made uneditable by using editable callback.

Code: [Select]
editable: function(ui){
  return !ui.rowData.pq_gsummary;
}

Similarly delete button can be shown in non-summary rows by using column.render callback.

column.render = function(ui){
  if( !ui.rowData.pq_gsummary ){
    return delete button markup.
  }
}

But as mentioned earlier batch editing and grouping are incompatible and can't be used together.