Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Closed] Javascript Grid - select text

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Closed] Javascript Grid - select text
 Login/Join
 
Gold member
posted
I am trying to replace an editable ActiveX grid on a maintain form with a js grid. I have replicated the majority of the functionality. The problem I have not been able to figure out is how to select all of the text in a cell when the customer either clicks on the cell or tabs to the cell from a cell before it. In the ActiveX grid the cell contents are automatically selected and allows the customer to start type to change the data if desired. In the js grid, the focus is on the cell, but the cursor is placed in front of the text in the cell. If the customer is going to change the contents, they have to double click to select all the text otherwise whatever they enter will be prepended to the original value. Below is the 2 event handlers I currently have defined. Unfortunately, neither of the events below will capture a cellfocus event when the user double clicks in one column and tabs to the next without changing the first column.

function OnGrid1_OnLClicked ( int col, long row, boolean updn, boolean processed) {
var dg = document.Form1.Grid1;
var currRow = dg.GetCurrentRow();
var prevRow = document. Form1.txtLastRow.value;
if (typeof currRow == 'undefined')
{
currRow=prevRow;
}
var columnCount = dg.GetNumberColumns();
setRowBackColor(dg, columnCount, currRow, prevRow);
document. Form1. txtLastRow.value = currRow;
document. Form1.txtIndex.value = currRow;
if (col == 1)
{
IWCTrigger("GetData")
}
else {
//want to select all text in first column of the currRow without making the customer double click a second time
dg.SetCellFocus(col, currRow) ;
}
}

function OnGrid1_OnCellChanged ( long col, long row, string text) {
var dg = document. Form1. Grid1;
var selectedCol = col + 1;
if (col == 0)
{
selectedCol = 2; //skip read only column
}
else if (col == 2) {
selectedCol = 6; //skip read only columnst
}
//want to select all text in selectedCol of the currRow
dg.SetCellFocus(selectedCol, row) ;
}

This message has been edited. Last edited by: Deana,


WebFOCUS 7.6.8 and 7.7.03; Windows Server 2003 R2 and Windows Server 2008 R2, respectively; Development environments - Windows Server 2003 R2 and Windows 7 Professional, respectively;
excel, html, pdf
 
Posts: 89 | Registered: March 19, 2011Report This Post
Guru
posted Hide Post
quote:
I am trying to replace an editable ActiveX grid on a maintain form with a js grid. I have replicated the majority of the functionality. The problem I have not been able to figure out is how to select all of the text in a cell when the customer either clicks on the cell or tabs to the cell from a cell before it. In the ActiveX grid the cell contents are automatically selected and allows the customer to start type to change the data if desired. In the js grid, the focus is on the cell, but the cursor is placed in front of the text in the cell. If the customer is going to change the contents, they have to double click to select all the text otherwise whatever they enter will be prepended to the original value. Below is the 2 event handlers I currently have defined. Unfortunately, neither of the events below will capture a cellfocus event when the user double clicks in one column and tabs to the next without changing the first column.

function OnGrid1_OnLClicked ( int col, long row, boolean updn, boolean processed) {
var dg = document.Form1.Grid1;
var currRow = dg.GetCurrentRow();
var prevRow = document. Form1.txtLastRow.value;
if (typeof currRow == 'undefined')
{
currRow=prevRow;
}
var columnCount = dg.GetNumberColumns();
setRowBackColor(dg, columnCount, currRow, prevRow);
document. Form1. txtLastRow.value = currRow;
document. Form1.txtIndex.value = currRow;
if (col == 1)
{
IWCTrigger("GetData")
}
else {
//want to select all text in first column of the currRow without making the customer double click a second time
dg.SetCellFocus(col, currRow) ;
}
}

function OnGrid1_OnCellChanged ( long col, long row, string text) {
var dg = document. Form1. Grid1;
var selectedCol = col + 1;
if (col == 0)
{
selectedCol = 2; //skip read only column
}
else if (col == 2) {
selectedCol = 6; //skip read only columnst
}
//want to select all text in selectedCol of the currRow
dg.SetCellFocus(selectedCol, row) ;
}

WebFOCUS 7.6.8 and 7.7.03; Windows Server 2003 R2 and Windows Server 2008 R2, respectively; Development environments - Windows Server 2003 R2 and Windows 7 Professional, respectively;
excel, html, pdf



Hello Deana,

Just confirming with you regarding the version of WebFOCUS Maintain that you are using. Your signature indicates WebFOCUS 7.6.8 and 7.7.03.

To better assist you can you please provide the version of WebFOCUS this question is related to.

Thank you for participating in the Focal Point Forum.

Kind Regards,
Tamra Colangelo
IBI Focal Point Moderator


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Report This Post
Gold member
posted Hide Post
I apologize. The application in question is running on 7.7.03.


WebFOCUS 7.6.8 and 7.7.03; Windows Server 2003 R2 and Windows Server 2008 R2, respectively; Development environments - Windows Server 2003 R2 and Windows 7 Professional, respectively;
excel, html, pdf
 
Posts: 89 | Registered: March 19, 2011Report This Post
Master
posted Hide Post
Deana
As a test, could you place a button on the form and just have the JS event be:

function OnButton1_Click ( ) {
dg.OneClickEdit(true);
dg.SetCellFocus(1, 1)
}

Can you let me know if that highlights the text for you? I am on a later version but it is doing it for me. Also, what browser are you using?

Thanks
Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Gold member
posted Hide Post
Mark,

I created the button with the event as you requested. I tried
dg.OneClickEdit(true);
dg.SetCellFocus(0, 1); (column 1 is read only)

I also tried
Form1.dg.OneClickEdit(true);
and document.Form1.dg.OneClickEdit(true);

I tried all of these in the onClick event handler as well as in the JSGridOnload function in a .js file.

All of them put the focus in the correct cell, but the text is not highlighted and there cursor is placed to the left of the text.

On my development machine, I have IE 11 running in compatibility mode. The default version is 5, which I suspect may be the issue. I tried to figure out how to change the default version to 9. I have tried running without compatibility mode, but the ActiveX control does not load properly and is used extensively throughout the system.

IE 11 also appears to break all my event handlers, both maintain cases and js functions.
Deana


WebFOCUS 7.6.8 and 7.7.03; Windows Server 2003 R2 and Windows Server 2008 R2, respectively; Development environments - Windows Server 2003 R2 and Windows 7 Professional, respectively;
excel, html, pdf
 
Posts: 89 | Registered: March 19, 2011Report This Post
Master
posted Hide Post
Deana

Would it be possible for you to create a simple example, preferably one without a database, that fails for you? I want to try it here. I AM running in 8.009. That may also be a major difference.

You can sent it to Mark_Derwin@ibi.com

Thanks
Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Master
posted Hide Post
This is seems to be a problem with IE and the JS Grid that we cannot get around. I am sorry to say we cannot highlight the text in IE when the cell is selected.

However, now that you are going to the JS grid you should be able to use Firefox and / or Chrome and in both of these cases, the data in the cell highlights.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Gold member
posted Hide Post
Mark,

Thank you so much for you assistance. The good news is we will be able to use other browsers once I convert ALL the active X controls to js grids. I am not certain how many forms I have with the Active X control but it probably in the neighborhood of 50 more maintain programs to look at some have 0 forms and/or 0 grids and some have between 3-5 forms with 1-5 grids on each form.

The good news is I did figure out that since the cursor is placed in the first position, the user can press Shift+End and it will select all the text. It's not optimal, but is more fluid than having to use the mouse to double click every time. I am sure the customer will not be happy, but if I sell the fact that we can move to Chrome or Firefox when I complete all the grids, it will be accepted.

I really appreciate your time and assistance.

Deana


WebFOCUS 7.6.8 and 7.7.03; Windows Server 2003 R2 and Windows Server 2008 R2, respectively; Development environments - Windows Server 2003 R2 and Windows 7 Professional, respectively;
excel, html, pdf
 
Posts: 89 | Registered: March 19, 2011Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Closed] Javascript Grid - select text

Copyright © 1996-2020 Information Builders