Author Topic: Resize terminate inline editing  (Read 2399 times)

Mendrace

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 12
    • View Profile
Resize terminate inline editing
« on: May 08, 2017, 07:59:14 pm »
I have a small problem. The size of the grid is automatically adjusted for me with a surrounding div. This looks something like this:

Quote
$(".pq-grid").each(function(i) {
        $( this ).pqGrid("option", "width", outerDivWidth);
        $( this ).pqGrid("option", "height", outerDivHeight);
        $( this ).pqGrid("refresh");
});

This also works great. But on mobile devices the keyboard is shown when editing directly. This causes a resize. A "refresh" is called again on the grid. This will terminate the direct edit again. Is there a way to prevent this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Resize terminate inline editing
« Reply #1 on: May 08, 2017, 09:45:53 pm »
You could check whether the grid is in edit mode with API https://paramquery.com/pro/api#method-getEditCell

and don't resize the grid when it's.

Mendrace

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Resize terminate inline editing
« Reply #2 on: May 08, 2017, 11:41:48 pm »
Thank you. Works. Can I also check if the focus is on a search field (in the header)?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Resize terminate inline editing
« Reply #3 on: May 09, 2017, 10:39:24 pm »
There is no grid helper API for this.

However in js/ jQuery, it would be.

var $focus = $(document.activeElement) //focused element.
if( $focus.hasClass("pq-grid-hd-search-field") ){
  //don't resize $focus.closest(".pq-grid")
}