ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: bsolTeamBglr on January 24, 2018, 03:56:22 pm

Title: functionality for isDirty.
Post by: bsolTeamBglr on January 24, 2018, 03:56:22 pm
Hi ParamQuery,

In Grid, on load i have some data (refer image onLoadPortActivity) , i have selected the row and clicked the delete button
the respective row data has been deleted (refer image onDeletePortActivity).  How do I know, the row has been delete?

Note:
In cellSave() : how to get the Grid is 'isDirty' on delete of selected row.

Thanks,
BSOl Team
Title: Re: functionality for isDirty.
Post by: paramvir on January 25, 2018, 07:35:02 am
Your attachments are missing.

1. change event can be used to detect addition, update or deletion of records in grid. Specifically ui.deleteList.length > 0 inside the event listener whenever there is deletion of records.

https://paramquery.com/pro/api#event-change

2. isDirty ( returns true/false) can be used only when tracking in the grid is on.

https://paramquery.com/pro/api#option-trackModel
Title: Re: functionality for isDirty.
Post by: bsolTeamBglr on January 29, 2018, 03:36:33 pm
Hi ParamQuery,

Our requirement is not to providing the delete button over the rows. If user has selected the row and clicked on delete button (key board delete button) that particular row has been deleted. Then, how do I get to know the row has been deleted from that Grid, while clicking save button for the Grid.

Please, check with attached images.
Title: Re: functionality for isDirty.
Post by: paramvir on January 29, 2018, 11:20:37 pm
Delete key doesn't delete the rows, but clears the content of cells by setting them to undefined.

change event can be used to detect that as ui.source == 'clear' in the event listener.

Code: [Select]
change: function(evt, ui){
  if( ui.source == 'clear' ){
    //cells cleared by delete key.
  }
}


Also in a listener to save button, grid.getChanges() method can be used to check whether any field in updateList is undefined.

Code: [Select]
var changes = grid.getChanges({ format: 'byVal' }),
  updateList = changes.updateList;

updateList.forEach( function ( rd ){
  for(var key in updateList ){
    if ( rd[ key ] === undefined ){
       //cells cleared
    }
  }
})
Title: Re: functionality for isDirty.
Post by: bsolTeamBglr on February 05, 2018, 10:57:05 am
Hi ParamQuery,

How to disable the clear data, when we click on delete button.

Ex:
 I have used : selectionModel: { type: 'row', mode: 'single',onTab: 'nextFocus'},
this is working for some grid, but not for all grids.
 
Title: Re: functionality for isDirty.
Post by: paramvir on February 05, 2018, 12:36:21 pm
Please use this:

Code: [Select]
beforeValidate: function(evt, ui){
if(ui.source=='clear'){
return false;
}    
},