jahlxx Posted July 1, 2016 Posted July 1, 2016 Hi. When rowselect in unidbgrid is set to true, the selected row change its color, but I can't see the wich is the actual column, bvecause all the row is in the same color. In there any way to change the color of the actual cell when roeselect is set to true? Thanks. Quote
Sherzod Posted July 1, 2016 Posted July 1, 2016 Hi, For now can you try this approach ?!: 1. UniDBGrid1->Options->dgRowSelect = False 2. UniDBGrid1->ClientEvents->ExtEvents [Ext.selection.CellModel[cellModel]] function cellModel.selectionchange(sender, selected, eOpts) { setTimeout(function(){ sender.view.getNode(sender.getLastSelected().getId()).className = 'x-grid-row x-grid-data-row x-grid-row-selected'; }, 1); } function cellModel.deselect(sender, record, row, column, eOpts) { setTimeout(function(){ sender.view.getNode(row).className = 'x-grid-row x-grid-data-row'; }, 0); } Best regards. Quote
arilotta Posted January 2, 2019 Posted January 2, 2019 Hi Sherzod, the above approach is not working anymore in the new EXTJS. I tried to replace: - "x-grid-row x-grid-data-row" with "x-grid-item" - "x-grid-row x-grid-data-row x-grid-row-selected" with "x-grid-item x-grid-item-selected" but I did not work. Could you help me ? Quote
Sherzod Posted January 2, 2019 Posted January 2, 2019 2 hours ago, arilotta said: the above approach is not working anymore in the new EXTJS Hello, On 7/1/2016 at 5:13 PM, jahlxx said: When rowselect in unidbgrid is set to true, the selected row change its color, but I can't see the wich is the actual column, bvecause all the row is in the same color. Do you mean this question? Quote
arilotta Posted January 2, 2019 Posted January 2, 2019 No, I'm using cellModel.selectionchange and cellModel.deselect as above to draw a grid indicator on the first column, when grid has dgRowSelect=false and dgEditing=true See also my post: Now this code is not working anymore... Quote
Sherzod Posted January 2, 2019 Posted January 2, 2019 Ok, Sorry, can you explain your issue again by indicating where the problem is and, if possible, can you make a small testcase for this ?! Quote
arilotta Posted January 4, 2019 Posted January 4, 2019 Hi Sherzod, I've attached a simple testcase. I am trying to show a grid indicator on the first column of a grid, when dgRowSelect=FALSE, to show the user the current record. I don't want to use the standard cell color background to show the selected cell. Just see the SerUniDbGrid_indicator_testcase.zipverModule.CustomCSS; the supplied image "right-arrow-button.png" should be put where the EXE is compiled (Win32\Debug) In the Main OnFormCreate I manage the grdi events cellModel.deselect and cellModel.selectionchange In addition in the grid OnAfterLoad event I force the "right-arrow-button" to have the style applied when the grid is loaded at the beginning. This solution used to work in EXTJS4, while in the newer EXTJS6 it has some problems, it hangs frequently. Just click on the grid, changing row and column to see the problem. Is there a better solution with EXTJS6 to achieve the desired behaviour ? Thank you Quote
Sherzod Posted January 4, 2019 Posted January 4, 2019 Hi, Thanks for the testcase. I will try to check it and let you know Quote
arilotta Posted January 9, 2019 Posted January 9, 2019 Hi, I managed it to work, I attached a sample for anyone interested in. Basically, I replaced - all the occurrences of 'x-grid-row x-grid-data-row x-grid-row-selected' with 'x-grid-item x-grid-item-selected' - all the occurrences of 'x-grid-row x-grid-data-row' with 'x-grid-item' - I moved the initialization of the style from event OnAfterLoad to event OnSelectionChange: procedure TMainForm.UniDBGrid1SelectionChange(Sender: TObject); begin UniSession.AddJS(UniDBGrid1.JSName+'.view.getNode('+IntToStr(UniDBGrid1.CurrGridRow)+').className = ''x-grid-item x-grid-item-selected''; '); end; @Sherzod, if there is a better solution/implementation, please let me know. Thanks UniDbGrid_indicator_testcase.zip Quote
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.