Author Topic: Questions on Inline Editing  (Read 413 times)

brwncald

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 16
    • View Profile
Questions on Inline Editing
« on: April 27, 2022, 03:20:50 am »
Hi,
I have four more questions on inline editing.
See the following JSFiddle for code to demonstrate the issues:
https://jsfiddle.net/glt101/8tsy2b1x/



1) After making a selection in the inline drop down list, the list disappears.
The drop down list needs to keep its current selection and remain visible until the Update or Cancel button is clicked.
How do we prevent the removal of the drop down list after a selection is made?

2) The value chosen in the inline drop down list is used to set which fields are editable.
For example, this is done using:

        var oColumnModel = grid.option("colModel");
        iOrdinal = grid.getColIndx({ dataIndx: "profits" });
        oColumnModel[iOrdinal].editable = true;

However this marks all rows in the column as editable.
How do we set just the field in the currently edited row as editable?

3) After clicking on the drop down list, when scrolling the window to the right, the drop down list does not stay with the column. It remains fixed in its location in the browser window.
How do we maintain the correct position of the drop down list when scrolling the window left and right?
Curiously, in JSFiddle, the selection list disappears as it loses focus (as soon as you click the scroll bar). Neither behavior should happen.

4) When the Cancel button is clicked the changes to the row should be rolled back, but they are not.
How do we make the Cancel button roll back the changes in this case?

Cheers,
Geoff

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Questions on Inline Editing
« Reply #1 on: April 27, 2022, 03:29:06 pm »
1. only one editor stays open in pqgrid. select list is closed when another editor is opened or some other control is focused on the page. However clicksToEdit: 1 can be used for convenience.

Code: [Select]
editModel:{
     clicksToEdit: 1
}, 

2. please use column.editable callback to set conditional editability of cells.

Code: [Select]
editable: function(ui) {
     return ( ["103", "104"].indexOf(ui.rowData.ReasonCode) != -1  && this.isEditableRow(ui) );                   
},

3. following code closes the editor when grid is scrolled.
 
Code: [Select]
scroll: function(){
   this.quitEditMode();
}

4. Declaring primary key is mandatory for transactional methods.

Code: [Select]
dataModel: {
      data: oData,
      recIndx: 'rank' //primary key
},

jsfiddle: https://jsfiddle.net/q3ox8a7h/


PS: I've removed unnecessary and irrelevant code from jsfiddle
« Last Edit: April 27, 2022, 05:52:56 pm by paramvir »

brwncald

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Questions on Inline Editing
« Reply #2 on: April 28, 2022, 06:12:21 am »
Thanks - this helped a lot.
I was able to fix all of the issues.

Cheers,
Geoff