Jump to content

Display a cell or row of a TUniDBGrid in a different style


cdev

Recommended Posts

Hi,

 

I want the selected row/cell in a TUniDBGrid to be displayed in a particular way.

I have found that this can be done with this code:

.x-grid-row-selected .x-grid-cell-inner {
    font-weight: bold;
    background-color:red;
}

Where should this be entered ? 

I guess in the UniEvents-property of the UniDBGrid, but there I can select Ext.grid.Panel, Ext.data.Store, Ext.selection.CellModel,  Ext.selection.RowModel, Ext.selection.ChekboxModel and Ext.toolbar.Paging.  And in what event should I put this code ?

Thank you

Link to comment
Share on other sites

in MainModule

 

procedure TUniMainModule.LoadScriptCSS;
begin
  if upMobile in UniMainModule.UniPlatforms then
  begin
    UniSession.AddJS('Ext.Loader.loadScript("/files/' + cCSSDir + 'custommob.css")');
  end;

  if upDesktop in UniMainModule.UniPlatforms then
  begin
    UniSession.AddJS('Ext.Loader.loadScript("/files/' + cCSSDir + 'custom.css")');
  end;
end;


procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean);
begin
  LoadScriptCSS;
...
...
end;

 

  • Upvote 1
Link to comment
Share on other sites

That's nice !  I didnot know this LayoutConfig.cls property: very interesting.

Unfortunately, this did not do the trick.  I want the color of the selected row to be painted in red.  But with this CSS-code this is not working.

Do you have an idea how I could change this blue selected row color in for example red ?

image.png.a5df066273f9a7d6abebe177cb23a34c.png

Link to comment
Share on other sites

9 minutes ago, cdev said:

I want the color of the selected row to be painted in red. 

use event OnDrawColumnCell

 

 Attribs.Color

Attribs.Font.Color

 

 

Attribs.Style.Cls := 'myDelCell';// custom.css - for cell border

CustomCSS^

.myDelCell {
	border-top: 1px solid red !important;
	border-bottom: 1px solid red !important;
}

 

Link to comment
Share on other sites

On 12/26/2020 at 5:20 PM, irigsoft said:

Try this:

/*color selected row*/
.DBG .x-grid-item-selected .x-grid-cell {
      font-weight: bold!important;
     background-color:red!important;
    }
 

Happy hollidays

Hi Irigsoft,

 

Same result.

On 12/26/2020 at 5:20 PM, irigsoft said:

Try this:

/*color selected row*/
.DBG .x-grid-item-selected .x-grid-cell {
      font-weight: bold!important;
     background-color:red!important;
    }
 

Happy hollidays

 

Hi.

Testing with 1.90.0.1542 on "uni_carbon_triton" theme.

still not working.

 

Happy Holidays! 

:)

 

Thanks,

Frances

Link to comment
Share on other sites

  • 2 months later...
24 minutes ago, jahlxx said:

Hi.

 

How can I change font type ans size of dbgrids?

I'm trying this in custom css, with no success:

.x-grid-cell-inner {
   font: normal 12px arial;
}

How can I do it?

Thanks.

 

If You use !important ?

.x-grid-cell-inner {
   font: normal 12px arial !important;
}

Link to comment
Share on other sites

21 minutes ago, jahlxx said:

.x-grid-cell-inner {
   font: normal 12px arial;
}

It may not always work. Because this rule can be overridden by another rule which is used by the theme.

By the way, this rule works for the classic theme.

Link to comment
Share on other sites

Ok. For example, in  custom CSS:

.MyTree .x-grid-cell-inner {
    white-space: nowrap !important;
      border-bottom: 0px solid black !important;
      border-right: 0px solid black !important;
}

.x-grid-cell-inner {
    white-space: nowrap !important;
      border-bottom: 1px solid black !important;
      border-right: 1px solid black !important;
}

To the treeview, assign the cls MyTree, and left blank in all other grid in the application.

The tree is without lines, and all the grids, are with lines.

With this, I only modify the exceptions, bnot all the grids.

Thanks.

 

Link to comment
Share on other sites

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