Jump to content

color part of text in dbgrid cell


mazluta

Recommended Posts

hi, i search the form for "color part grid"

i want to paint part of text in the value of the grid cell.

instead of filtering record i want to iterate on all the records in the table (witch is in-memory table) - no more then 100 record per session

and if i found the text in the value i want to paint just this part (when ever it exists in the value)

so, the user can see in what records the value he look for exists and select the record with checkbox.

 

i found some JS code using mark.js regard to memo component,

but how can i implement this on the grid cell?

This work, but paint all the cell.

    if pos(edFiltertxt.Text,Column.Field.AsString) > 0 then
    begin
      Attribs.Style.Style := 'background-color: yellow;';
    end
 

i want to paint PART of the cell with

UniDBGrid1.JSInterface.JSCode(
    '$('+ UniDBGrid1.JSName +'.getDoc().mark("'+edFiltertxt.Text+'",{});');

any idea?

 

 

Link to comment
Share on other sites

this done with 

image.png.41399c28995d139540add3ad3e362f27.png

and in - DynMezaheGrid   DrawColumnCell

image.png.6cf6b6fbe906aa2010517ab25dbc9462.png

and the result .... the col field with the value is yellow.

image.png.bbaa4ef2f357b9d464665ea780eb3af5.png

i want JUST the value to get the color

is that possible?

Any MASTER that can solve that mysteries thing ?

Link to comment
Share on other sites

12 hours ago, mazluta said:

this done with 

image.png.41399c28995d139540add3ad3e362f27.png

and in - DynMezaheGrid   DrawColumnCell

image.png.6cf6b6fbe906aa2010517ab25dbc9462.png

and the result .... the col field with the value is yellow.

image.png.bbaa4ef2f357b9d464665ea780eb3af5.png

i want JUST the value to get the color

is that possible?

Any MASTER that can solve that mysteries thing ?

Hello,

Instead of adding background color, you need to change the record in the grid like below

Uni<span style="color:red">GUI</span>

image.png.1f699e003044089ae218979c97b0cb6a.png

Link to comment
Share on other sites

Hi Hayri, 

thanks for the answer,

i have a grid with 25 records - all have different text in them - it's dynamic data...

that grid have 5 column,

i can search by any column,

the data is loaded from table, each user have it's on data.

can you give me some code example - not just idea..

 

Link to comment
Share on other sites

2 hours ago, mazluta said:

Hi Hayri, 

thanks for the answer,

i have a grid with 25 records - all have different text in them - it's dynamic data...

that grid have 5 column,

i can search by any column,

the data is loaded from table, each user have it's on data.

can you give me some code example - not just idea..

 

Hello

Please create a test case so I can work on it

Link to comment
Share on other sites

hi,

I back.

please see the rar attach.

run the program,

on the name filter field type - r (just the char "r")

all the line with the "r" in value of the field - become - yellow.

image.png.cb67ae60c7b10976d3e80ec1848b64c3.png

 

now --- type "a" (the char "a" - so you have "ra" in the filter field)

now - just the records with the "ra" in the value - become - yellow.

image.png.a29b395425a7b0f58a8d1ed8f8b8e518.png

this help the user - to see - in what records the value exists (it good for small tables.... but good for me in the search lookup tables).

 

BUT - i want just the "ra" inside the field value become - yellow

not all the field....

yossi

ColorGrid.rar

  • Like 1
Link to comment
Share on other sites

15 hours ago, mazluta said:

hi,

I back.

please see the rar attach.

run the program,

on the name filter field type - r (just the char "r")

all the line with the "r" in value of the field - become - yellow.

image.png.cb67ae60c7b10976d3e80ec1848b64c3.png

 

now --- type "a" (the char "a" - so you have "ra" in the filter field)

now - just the records with the "ra" in the value - become - yellow.

image.png.a29b395425a7b0f58a8d1ed8f8b8e518.png

this help the user - to see - in what records the value exists (it good for small tables.... but good for me in the search lookup tables).

 

BUT - i want just the "ra" inside the field value become - yellow

not all the field....

yossi 

ColorGrid.rar 59.41 kB · 1 download

Hello

Please find the attached modified example.

image.png.eeebb3dcbc11c06f3099d783115aecdf.png

highlight.zip

  • Like 1
Link to comment
Share on other sites

okkkk

good work.

where dinosaur like me can learn about those tricks in ext.js

where are documents about this function and how they influence ?

===============

    JSAssign('getColumns()[1].renderer', [JSFunction('value, metaData, record, rowIndex, colIndex, store, view',
                                          'internalRender(value, metaData, record, rowIndex, colIndex, store, view);'+
                                          'return value.replaceAll('+edName.JSName+'.value, "<span style=''background-color: yellow;''>" + '+edName.JSName+'.value + "</span>"); ' )])
================

this put permanent function in the client DOM?

and

==================

    JSAddListener('change', JSFunction('', tstGrid.JSName+'.getView().refresh();'))
==================

like KeyPress in the DOM?

++++++++++++++++++

because the UniFormAfterShow occure only one time at the start

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