Jump to content
uniGUI Discussion Forums
jahlxx

unidbgrid rowselect

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi,

Thanks for the testcase.

I will try to check it and let you know

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×