Author Topic: Edit box arrow key navigation  (Read 2275 times)

mscodigno

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 24
    • View Profile
Edit box arrow key navigation
« on: May 11, 2021, 03:14:14 pm »
Hello, I want to add navigation with arrow keys to the editor. I tried this topic but it didn't work.
https://paramquery.com/forum/index.php?topic=2630.msg10101#msg10101


http://jsfiddle.net/zekeriyaerogluu/kqmzv45u/41/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Edit box arrow key navigation
« Reply #1 on: May 11, 2021, 04:01:05 pm »
That one is a different topic.

How exactly do you want to add navigation with arrow keys to the editor. Please describe your requirements.

mscodigno

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Edit box arrow key navigation
« Reply #2 on: May 11, 2021, 04:24:36 pm »
I want to switch to text boxes in other cells with the arrow keys when the text box is open

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Edit box arrow key navigation
« Reply #3 on: May 13, 2021, 11:07:37 am »
Code: [Select]
editorKeyDown: function(evt, ui) {
  var obj = $.extend({}, ui), editCell;
  if(evt.keyCode == $.ui.keyCode.DOWN){
    obj.rowIndx++;
    obj.rowIndxPage++;
    editCell = true;
  }
  else if (evt.keyCode == $.ui.keyCode.RIGHT){
    obj.colIndx++;     
    editCell = true;
  }
  if(editCell){
    this.saveEditCell();
    this.editCell(obj)       
    return false;
  }
},

https://jsfiddle.net/ah74vkt2/2/

Above is a simple outline of the code and involved event.

Please update the logic to include checks for boundary conditions ( rowIndx should not be < 0 and should not exceed data length etc ) and if there are any hidden rows or columns.
« Last Edit: May 17, 2021, 06:56:08 pm by paramvir »

mscodigno

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Edit box arrow key navigation
« Reply #4 on: May 20, 2021, 01:53:19 pm »
Hello, thanks for the answer.

keyCode.RIGHT or LEFT: How can I skip the non-editable colons and switch to the other column?

keyCode.DOWN or UP: How can I skip summary and group headings and skip to other lines?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Edit box arrow key navigation
« Reply #5 on: May 25, 2021, 10:25:14 am »
non editable columns can be identified by column.editable == false condition.

group headings have row meta data rowData.pq_gtitle = true

group summary rows have row meta data rowData.pq_gsummary = true

So keep on incrementing obj.colIndx++ until editable column is found and increment obj.rowIndx++ and obj.rowIndxPage++ until non grouping title / summary row is found.

Hope it helps.

mscodigno

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Edit box arrow key navigation
« Reply #6 on: May 31, 2021, 06:28:09 pm »