Jump to content

Recommended Posts

Posted

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.

Posted

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.

  • 2 years later...
Posted

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 ?

Posted
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?

Posted

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...

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...