Jump to content

AutoEdit in UniDBGrid


Recommended Posts

Hello!

Simple implementation...

UniDBGrid.ClientEvents.ExtEvents ->

1. 

function beforeedit(editor, context, eOpts) 
{
    editor.grid.needToClear ? context.value = "" : {};
}

2. 

function beforeitemkeydown(sender, record, item, index, e, eOpts)
{
    var me=sender.grid;
    me.needToClear = (e.getKey() !== 13 && e.getKey() !== 9);
}

3. 

function beforeitemkeypress(sender, record, item, index, e, eOpts)
{
    var me=sender.grid;
    if (!me.editingPlugin.editing) {
        me.editingPlugin.startEditByPosition({
            column: me.uniCol,
            row: me.uniRow     
       })
    }
}

 

  • Upvote 1
Link to comment
Share on other sites

Good morning, Thanks for your AutoEdit example,

it is possible that you put the same example but with a legacy dbgrid, because with the provided example, it would be necessary to change many dbgrid and additionally be modifying it manually every time a new dbgrid is placed in a Form? The same would apply to an example that you kindly made available to everyone, such as the automatic filters in the dbgrid with the content of the columns. Thanks for your attention

Link to comment
Share on other sites

I tried it and doesn't work. I had to press enter to activate edition. What I understand and what personally need is that the control enters in edition mode by pressing any key and by the way when focus to the next element it will be the next NOT READONLY element to do a correct edition or append flow. For intensive data manipulation this is a MUST. I cannot beleive that something that simple is not developed for this components. 

Link to comment
Share on other sites

6 hours ago, Alf said:

I tried it and doesn't work. I had to press enter to activate edition. What I understand and what personally need is that the control enters in edition mode by pressing any key and by the way when focus to the next element it will be the next NOT READONLY element to do a correct edition or append flow. For intensive data manipulation this is a MUST. I cannot beleive that something that simple is not developed for this components. 

Please make a simple testcase. I will check why it does not work for you.

Link to comment
Share on other sites

13 hours ago, Alf said:

Test Case 

uniGUITestCase.rar

Hi,

Can you check if this approach works for you (just for test)?

1. Delete all previous JS codes..! 

2. 

function beforeedit(editor, context, eOpts)
{
  this.needToClear == true ? context.value = "" : {};
}

3.

function cellkeydown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts)
{
  sender.ownerGrid.needToClear = (e.getKey() !== 13 && e.getKey() !== 9);
    
  if (e.getKey() !== 37 && e.getKey() !== 38 && e.getKey() !== 39 && e.getKey() !== 40) {
    var locked = sender.ownerCt.isLocked;
    var lockedColLength = sender.ownerGrid.lockedGrid.columnManager.columns.length;
    var colIndx = !locked ? cellIndex + lockedColLength : cellIndex;
    
    sender.ownerGrid.editingPlugin.startEdit(record, colIndx);
  }
}

 

Link to comment
Share on other sites

Hi Sherzod, can you please explain a little bit the code? 

My comments:

- If you are positioned on a cell and type anything it will go to edit mode. This is what is needed of course but after you do that anytime you double click on a cell to edit it, the content is erased from the cell. In case you click in another cell you will get the exception in the image and it shows like the cell is not empty but at data level it is false. What is the function of 

needToClear ??? Maybe this is the reason for this behavoir

Wen you use the arrows keys to move in a row of the same column the columns lost the focus after an edition. It should be great if in a middle of an edition you could use the arrows instead of clicking. Now you can't. 

How can I just press a button and put the cell in edit mode? Of course the active record? 

Thanks... 

 

Clipboard02.jpg

Link to comment
Share on other sites

2 hours ago, Alf said:

This is what is needed of course but after you do that anytime you double click on a cell to edit it, the content is erased from the cell. In case you click in another cell you will get the exception in the image and it shows like the cell is not empty but at data level it is false. What is the function of 


needToClear ??? Maybe this is the reason for this behavoir

Hi, 

I will check it. 

Link to comment
Share on other sites

2 hours ago, Alf said:

In case you click in another cell you will get the exception in the image and it shows like the cell is not empty but at data level it is false. What is the function of 


needToClear ??? Maybe this is the reason for this behavoir

Yes, please add this JS event too:

function edit(editor, context, eOpts)
{
  this.needToClear = false;
}

 

Link to comment
Share on other sites

Now works better but anyway after a post to the database the focus to the column is lost. What is the meaning of needtoClear? Where can I find info about those properties? What you wanted to do with the first method was to make the text selected when you start editing? 

I sent you the contact  by PM if u want to do the team session. 

Thanks in advance, 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...