Jump to content

Show rowbased hint/tooltip in UniDBGrid


rhennink

Recommended Posts

Sure! thnx!!

 

In this UniDBGrid we show the detail-data of the PlanningLines.

When selecting a Row (so the PlanningLine) I would like to show a tooltip/hint referring to the remark-field of the database-line.

 

in short; when changing the row in the DBGrid, the tooltip.hint should changed with the remark-value of the line.

Link to comment
Share on other sites

  • 2 months later...

Hi,

 

I tried the script in my application, but it doesn't work.

 

The column is the first in the DBGrid. An empty tooltip will be shown, but also wrong text.

 

I set the ShowToolTip and the ShowToolTipAlways to True.

Otherwise there is no tooltip to see.

 

Best regards

 

post-1689-0-95527100-1523603438_thumb.png

Link to comment
Share on other sites

Hi,

 

I set the ShowToolTip and the ShowToolTipAlways to True.

 

Yes sorry, you can use these properties instead of the "script"

 

 

I tried the script in my application, but it doesn't work.

 

The column is the first in the DBGrid. An empty tooltip will be shown, but also wrong text.

 

I set the ShowToolTip and the ShowToolTipAlways to True.

Otherwise there is no tooltip to see.

 

Can you make a simple testcase for this?

Link to comment
Share on other sites

Hi,

 

I add the column of the DBGrid in the "Create"-Methode of a frame

After adding (in the same procedure) I set the property ShowToolTip and ShowToolTipAlways to True.

 

I tried  also without the script, but I get the same result as you can see in the picture.

 

Could it be a problem when adding new columns at runtime?

 

Best regards

Link to comment
Share on other sites

Here is quick example:  UniDBGrid->Ext Events->ViewReady Event:

function viewready(sender, eOpts)
{
 sender.getColumns()[0].renderer = function (value, metadata, record) {               
    myToolTipText = "<table class='tblRecGridRowToolTip'>"+
                     "<tr class='tdToolTip'>"+
                      "<td class='tblRecGridRowToolTipTitle'>Reference:</td>"+
                      "<td class='tblRecGridRowToolTipValue'>5006247</td>"+
                     "</tr>"+
                     "<tr class='tdToolTip'>"+
                      "<td class='tblRecGridRowToolTipTitle'>Debit account:</td>"+
                      "<td class='tblRecGridRowToolTipValue'>Suppliers account</td>"+
                     "</tr>"+
                    "</table>"; 
    metadata.tdAttr = 'data-qclass="dvQtip" data-qtip="' + myToolTipText + '"';
 };
 MainForm.UniDBGrid1.getView().refresh(); 
}

You may use Xtemplate for you Tool-tip text and from 'record' variable you can extract the fields value.

  • Like 1
Link to comment
Share on other sites

Hi,

 

thank you very much. It looks very nice.

But in my application I create some columns at runtime in the "create" procedure (constructor).

Is there also any way to use the solution, because there are a lot of possibilities with this kind of tooltip.

 

Best regards

Link to comment
Share on other sites

...function (value, metadata, record)...

You have the record parameter which points to the whole row, so you can display any field you want.

 

record.get('0') holds the value of the field which belongs the first column.

record.get('1') holds the value of the field which belongs the second column.

record.get('2') holds the value of the field which belongs the third column.

.....

 

Regardless the name of the field in server side, Unigui always translated the field names to: '0','1','2','3','4'... 

Link to comment
Share on other sites

Hi,

 

it is not so easy to make an example, because it is a complex project, but I try to explain.

 

I have prepared a common function to prepare all used DBGrids. The options of the Grid will be

configured. After that all columns will be added at runtime, also in a common function.

 

I did it in this way, because we have to be very open to make changes for different customers.

 

Both functions (configure the options of the Grid and adding columns) will be fired in the constructor of the different frames.

And I think this is the problem, because for the viewready function it seems to be too late.

 

Best regards

Link to comment
Share on other sites

  • 1 year later...
On 4/17/2018 at 5:11 PM, mhmda said:

Here is quick example:  UniDBGrid->Ext Events->ViewReady Event:


function viewready(sender, eOpts)
{
 sender.getColumns()[0].renderer = function (value, metadata, record) {               
    myToolTipText = "<table class='tblRecGridRowToolTip'>"+
                     "<tr class='tdToolTip'>"+
                      "<td class='tblRecGridRowToolTipTitle'>Reference:</td>"+
                      "<td class='tblRecGridRowToolTipValue'>5006247</td>"+
                     "</tr>"+
                     "<tr class='tdToolTip'>"+
                      "<td class='tblRecGridRowToolTipTitle'>Debit account:</td>"+
                      "<td class='tblRecGridRowToolTipValue'>Suppliers account</td>"+
                     "</tr>"+
                    "</table>"; 
    metadata.tdAttr = 'data-qclass="dvQtip" data-qtip="' + myToolTipText + '"';
 };
 MainForm.UniDBGrid1.getView().refresh(); 
}

You may use Xtemplate for you Tool-tip text and from 'record' variable you can extract the fields value.

Can you make an example in practice?

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