ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: bmais on November 05, 2013, 06:28:11 am

Title: Changes not seen when user clicks outside grid
Post by: bmais on November 05, 2013, 06:28:11 am
Is there a way to fire the saveEditCell when the grid looses focus?  My users will edit a cell and then click elsewhere on the form.  The cellUnSelect event is ignored.

Thanks
Title: Re: Changes not seen when user clicks outside grid
Post by: paramvir on November 05, 2013, 07:03:40 pm
Bill

You can use on jQuery API http://api.jquery.com/on/ (http://api.jquery.com/on/) to add delegate blur event something like this

$( document ).on ( "blur", ".pq-editor-focus", function(evt){
  var $grid = $(this).closest(".pq-grid");
  $grid.pqGrid("saveEditCell");
});

you may need to make minor adjustments to this code.
Title: Re: Changes not seen when user clicks outside grid
Post by: bmais on February 20, 2014, 11:50:51 pm
We just noticed this code messes with the grid calendar. 
The calendar displays but you cannot choose a date. 
The error message is:
Uncaught Missing instance data for this datepicker

We modified your code as follows:
$( document ).on ( "blur", ".pq-editor-focus", function(evt){
  var $grid = $(this).closest(".pq-grid");
  //$grid.pqGrid("saveEditCell");
  $grid.pqGrid("quitEditMode");
});

Any thoughts?
Thanks,
Bill
Title: Re: Changes not seen when user clicks outside grid
Post by: paramvir on February 22, 2014, 12:36:49 am
Any editor which requires the focus outside of the textbox to function would be problematic e.g. datepicker, autocomplete.

datepicker can be excluded from this rule:

$(document).on("blur", ".pq-editor-focus:not(.hasDatepicker)", function (evt) {
      var $grid = $(this).closest(".pq-grid");
      //$grid.pqGrid("saveEditCell");
      $grid.pqGrid("quitEditMode");
});