jahlxx Posted April 16, 2018 Share Posted April 16, 2018 H, I do this for dbgrids in run time: tunidbgrid(xdbg).ClientEvents.unievents.Values['beforeinit']:='function beforeinit(sender, config)' + '{config.viewConfig.enableTextSelection = true;}'; This don't work. How can I do it in run time? Thanks. Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 16, 2018 Author Share Posted April 16, 2018 I need this for all the grids un the app. Can do this in CSS? in mainform script? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 16, 2018 Share Posted April 16, 2018 Hi, H, I do this for dbgrids in run time: tunidbgrid(xdbg).ClientEvents.unievents.Values['beforeinit']:='function beforeinit(sender, config)' + '{config.viewConfig.enableTextSelection = true;}'; This don't work. Where do you use this code? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 16, 2018 Author Share Posted April 16, 2018 in the onshow of the form that contains tje grid Enviado desde mi SM-A500FU mediante Tapatalk Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 16, 2018 Author Share Posted April 16, 2018 I am trying not write this in evwry client event of every dbgrid. Enviado desde mi SM-A500FU mediante Tapatalk Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 16, 2018 Share Posted April 16, 2018 in the onshow of the form that contains tje grid Enviado desde mi SM-A500FU mediante Tapatalk it should work Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 16, 2018 Share Posted April 16, 2018 Or, try this: MainForm -> Script: Ext.override(Ext.grid.View, { enableTextSelection: true }); Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 16, 2018 Author Share Posted April 16, 2018 Great!! Thanks. In mainfor is better. And this?: function containercontextmenu(sender, e, eOpts){ ajaxRequest(this, 'cellcontextmenu', ['ex='+e.getXY()[0], 'ey='+e.getXY()[1]]);} ths is also for every grid (extevents). Thanks. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 16, 2018 Share Posted April 16, 2018 UniDBGrid -> OnCellContextClick event ?? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 16, 2018 Author Share Posted April 16, 2018 yes Enviado desde mi SM-A500FU mediante Tapatalk Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 16, 2018 Author Share Posted April 16, 2018 UniDBGrid -> OnCellContextClick event ??but this don't work if grid is empty. this is the reason of my prior post. is possible to add in mainform script to not repeat in every dbgrid? Enviado desde mi SM-A500FU mediante Tapatalk Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 17, 2018 Share Posted April 17, 2018 but this don't work if grid is empty. Correct, because this applies to cells is possible to add in mainform script to not repeat in every dbgrid? Yes, it is possible, but I think, it is better to do this in the "code", for example, in the FormCreate event Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 17, 2018 Author Share Posted April 17, 2018 Sorry. Don't work. But I think it could be better in mainform script, because I do only once, not in every form and/or every dbgrid. How can I do it? Thanks. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 17, 2018 Share Posted April 17, 2018 Sorry. Don't work. What does not work? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 17, 2018 Author Share Posted April 17, 2018 add the code on form create has no effect in the grid Enviado desde mi SM-A500FU mediante Tapatalk Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 17, 2018 Author Share Posted April 17, 2018 as I can see, in general, add the code in run time to grids, don't work. for this, I think is better to add in mainform script (as you told me with enableTextSelection). Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 17, 2018 Share Posted April 17, 2018 as I can see, in general, add the code in run time to grids, don't work. Sorry, provide the code, I will analyze Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 17, 2018 Author Share Posted April 17, 2018 This is the code, in every dbgrid: function containercontextmenu(sender, e, eOpts){ ajaxRequest(this, 'cellcontextmenu', ['ex='+e.getXY()[0], 'ey='+e.getXY()[1]]);} And for not repeat in every one, I'm trying to do this: tunidbgrid(xdbg).ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' + '{ajaxRequest(this, cellcontextmenu, [ex=+e.getXY()[0], ey=+e.getXY()[1]]);}'; As you told me with cellcontextmenu, I'd like to do this in mainform script, and do only once, not in every dbgrid individually. Thanks. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 17, 2018 Share Posted April 17, 2018 procedure TMainForm.UniFormCreate(Sender: TObject); begin UniDBGrid1.ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' + '{ajaxRequest(this, "_cellcontextmenu", ["ex="+e.getXY()[0], "ey="+e.getXY()[1]]);}'; end; Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 17, 2018 Author Share Posted April 17, 2018 Sorry, but don't work. It does nothing if dbgrid is empty. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 17, 2018 Share Posted April 17, 2018 Sorry, but don't work. It does nothing if dbgrid is empty. procedure TMainForm.UniFormCreate(Sender: TObject); begin UniDBGrid1.ClientEvents.ExtEvents.Values['containercontextmenu']:='function containercontextmenu(sender, e, eOpts)' + '{ajaxRequest(this, "_cellcontextmenu", ["ex="+e.getXY()[0], "ey="+e.getXY()[1]]);}'; end; procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_cellcontextmenu' then begin ShowMessage('click'); end; end; Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 18, 2018 Author Share Posted April 18, 2018 ok. works. but could be better this?: procedure TMainForm.UniDBGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin if button=mbRight then menu.Popup(X, Y, UniDBGrid1);end; Using MouseDown instead of CellContextClick. Only with this don't need any more. It works without ajaxrequest. Is only a question. Could be this better solution? More clear? Thanks. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 18, 2018 Share Posted April 18, 2018 Hi, With CellContextClick, the event occurs only when the "right button" is clicked With MouseDown, the event occurs when you press "any button" Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 18, 2018 Author Share Posted April 18, 2018 Ok. I know. And what does it mean? Less performance? 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.