newsanti Posted May 11, 2023 Share Posted May 11, 2023 How to delay stringgrid send event back to server when user change selection? (User scroll with keyboard) 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 12, 2023 Share Posted May 12, 2023 8 hours ago, newsanti said: How to delay stringgrid send event back to server when user change selection? (User scroll with keyboard) I will check... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 12, 2023 Share Posted May 12, 2023 Seems found a workaround, will try post later. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 12, 2023 Share Posted May 12, 2023 10 hours ago, newsanti said: How to delay stringgrid send event back to server when user change selection? (User scroll with keyboard) Try this workaround: function afterrender(sender, eOpts) { sender.on('keydown', function() { if (!sender.getSelectionModel().isSuspended('select')) { sender.getSelectionModel().suspendEvent('select') } }); sender.on('keyup', function() { sender.getSelectionModel().resumeEvent('select'); sender.getSelectionModel().fireEvent( 'select', sender.getSelectionModel(), false, sender.getSelectionModel().getCurrentPosition().row, sender.getSelectionModel().getCurrentPosition().column ) }); } 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 12, 2023 Share Posted May 12, 2023 I think this can also be used for UniDBGrid. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 12, 2023 Share Posted May 12, 2023 3 hours ago, Sherzod said: function afterrender(sender, eOpts) { sender.on('keydown', function() { if (!sender.getSelectionModel().isSuspended('select')) { sender.getSelectionModel().suspendEvent('select') } }); sender.on('keyup', function() { sender.getSelectionModel().resumeEvent('select'); sender.getSelectionModel().fireEvent( 'select', sender.getSelectionModel(), false, sender.getSelectionModel().getCurrentPosition().row, sender.getSelectionModel().getCurrentPosition().column ) }); } And it gives some optimization. 1 Quote Link to comment Share on other sites More sharing options...
newsanti Posted June 19, 2023 Author Share Posted June 19, 2023 On 5/12/2023 at 2:09 PM, Sherzod said: Try this workaround: function afterrender(sender, eOpts) { sender.on('keydown', function() { if (!sender.getSelectionModel().isSuspended('select')) { sender.getSelectionModel().suspendEvent('select') } }); sender.on('keyup', function() { sender.getSelectionModel().resumeEvent('select'); sender.getSelectionModel().fireEvent( 'select', sender.getSelectionModel(), false, sender.getSelectionModel().getCurrentPosition().row, sender.getSelectionModel().getCurrentPosition().column ) }); } if Grid is Editing Mode...Editing Mode Exist. How to check Editing Mode in this script? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 19, 2023 Share Posted June 19, 2023 11 hours ago, newsanti said: if Grid is Editing Mode...Editing Mode Exist. How to check Editing Mode in this script? Hello, Why exactly in this script is not clear to me... Quote Link to comment Share on other sites More sharing options...
lema Posted November 16, 2023 Share Posted November 16, 2023 Hello, I'm trying to apply it, but it doesn't seem to be working for me. For every keyboard press, it still triggers a HandleEvent. To be sure, am I applying the workaround in the stringGrid->ClientEvents->ExtEvents->Ext.Grid.Panel->afterrender, right? I am using D11.3 and v.1.90.0.1567 Complete Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 16, 2023 Share Posted November 16, 2023 1 hour ago, lema said: For every keyboard press, it still triggers a HandleEvent Hello, That's right. This makes sense when you press and hold a key for a while. Quote Link to comment Share on other sites More sharing options...
lema Posted November 16, 2023 Share Posted November 16, 2023 Hello Sherzod. I now understand how it works. But, is there a way to completely disable these events, even for a keyboard or mouse click? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 16, 2023 Share Posted November 16, 2023 Hello, If the stringgrid is in read-only mode, and not related to other controls, and synchronization with the server is not important to you, then I think it is possible to disable these events. Quote Link to comment Share on other sites More sharing options...
lema Posted November 16, 2023 Share Posted November 16, 2023 23 minutes ago, Sherzod said: Hello, If the stringgrid is in read-only mode, and not related to other controls, and synchronization with the server is not important to you, then I think it is possible to disable these events. Exactly. I use the stringGrid just to show some data. No editing, no sync. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 17, 2023 Share Posted November 17, 2023 7 hours ago, lema said: Exactly. I use the stringGrid just to show some data. No editing, no sync. Okay, then try this approach: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniStringGrid1.JSInterface.JSAddListener('viewready', 'function(){this.getSelectionModel().suspendEvent("select")}'); end; 1 Quote Link to comment Share on other sites More sharing options...
lema Posted November 17, 2023 Share Posted November 17, 2023 4 hours ago, Sherzod said: Okay, then try this approach: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniStringGrid1.JSInterface.JSAddListener('viewready', 'function(){this.getSelectionModel().suspendEvent("select")}'); end; Yes! Thank you, Master ! Note: It works only when Grid rowselect is NOT enabled. To cover this case as well -without knowing if it's the correct way- I changed it to 'suspendEvents(),' and it seems to be working. UniStringGrid1.JSInterface.JSAddListener('viewready', 'function(){this.getSelectionModel().suspendEvents()}'); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 17, 2023 Share Posted November 17, 2023 Hello, 18 minutes ago, lema said: Note: It works only when Grid rowselect is NOT enabled. I couldn't reproduce. Works for me. 19 minutes ago, lema said: I changed it to 'suspendEvents(),' and it seems to be working. Yes, this disables all events (this is not recommended). Quote Link to comment Share on other sites More sharing options...
lema Posted November 17, 2023 Share Posted November 17, 2023 20 minutes ago, Sherzod said: Hello, I couldn't reproduce. Works for me. I am testing with the original StringGrid Demo (attached is my test). The only change I made, is setting the property goRowSelect to True. The suspendEvent("select") doesn't work with me (v.1.90.0.1567) Sherzod, I don't want to waste your time, don't bother with the issue. I think it's okay unless there's a problem in the application that I can't see right now... Thank you again ! StringGrid Demo.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 17, 2023 Share Posted November 17, 2023 7 minutes ago, lema said: StringGrid Demo.zip 4.49 kB · 0 downloads Sorry, maybe I made a mistake during testing. Try using selectionchange instead of select. 1 Quote Link to comment Share on other sites More sharing options...
picyka Posted November 17, 2023 Share Posted November 17, 2023 I'm sorry to give my opinion here, with the arrival of Grid Ligth, this issue will improve, right? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 17, 2023 Share Posted November 17, 2023 1 minute ago, picyka said: I'm sorry to give my opinion here, with the arrival of Grid Ligth, this issue will improve, right? Hello, In some sense yes. Quote Link to comment Share on other sites More sharing options...
picyka Posted November 17, 2023 Share Posted November 17, 2023 Disabling this feature there, if I want to get the data from the line to do something on the server, how would I have to synchronize it? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 17, 2023 Share Posted November 17, 2023 3 minutes ago, picyka said: Disabling this feature there, if I want to get the data from the line to do something on the server, how would I have to synchronize it? Well, there will be some method, say SaveChanges, in which the changed data is sent to the server... Quote Link to comment Share on other sites More sharing options...
picyka Posted November 17, 2023 Share Posted November 17, 2023 6 horas atrás, Sherzod disse: Ok, então tente esta abordagem: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniStringGrid1.JSInterface.JSAddListener('viewready', 'function(){this.getSelectionModel().suspendEvent("select")}'); end; And in this case here, let's say I want to click on an actionColumn to open a Form, how would I do it? I would have to position the dataset on the server Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 17, 2023 Share Posted November 17, 2023 3 minutes ago, picyka said: And in this case here, let's say I want to click on an actionColumn to open a Form, how would I do it? I would have to position the dataset on the server 13 minutes ago, picyka said: with the arrival of Grid Ligth All these nuances are still worth considering. Quote Link to comment Share on other sites More sharing options...
picyka Posted November 17, 2023 Share Posted November 17, 2023 2 minutos atrás, Sherzod disse: Todas essas nuances ainda valem a pena considerar. Alright, let's wait, a big hug! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.