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     [Solved] Js Grid on Maintain form loses data when returning to webfocus

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved] Js Grid on Maintain form loses data when returning to webfocus
 Login/Join
 
Gold member
posted
I am using 7.7.03 for this application.

I have a javascript grid on a maintain form. I have 1 column (comments) which is 750 characters; 1 column (fund) which must match the values in a drop-down list; 1 update indicator column, a handful other columns which can be modified directly within the grid and several read-only columns.

In order to allow the user to view all (or at least most) of the data on the screen, I have added a multi-line text box below the grid. When I change the information in the text box, I have a function which appears to successfully modify the data in the comments column.

I also have a drop-down list on the form for the second column. Using javascript, I successfully populate the correct column in the grid.

I manually change the regular editable columns directly within the grid.

Whenever I change the data in the grid, regardless of the method, the indicator column gets set to 'Y';

However, when I call a maintain function to update the records with changed data, the changes I made using the text box and drop-down are wiped out. The changes made directly within the grid are maintained. The values for the comments and fund columns revert to the original data. If I made changes directly within the grid, the indicator column value is maintained. If I only change the comments and/or fund columns, the indicator value reverts to what is was before.

If I change the comments and fund columns directly within the grid, the values are maintained.

I read an article by Mark which shows how to add a radio box to the columns within a grid, but I did not understand how to apply that to a drop-down which is populated with data from a table.

Any assistance is appreciated.

Deana

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
Master
posted Hide Post
When the user makes a selection from the drop box or enters data into the multi-line edit box I assume you are using JavaScript to take that value and place it into the grid? I would expect:
CellSetText(col, row, text);
If you are, are you setting the indicator there or are you expecting the OnCellChange event to fire? Maybe the JS command is not activating the OnCellChange event. Try updating the indicator field using CellSetText.

Any value set in a cell field using JS SHOULD get passed back to the server in the stack. I have created a simple test in 8.0 that shows that. I can send you that example and an example on how to place a dynamic list box in a grid cell. Let me know where to send it.

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

Thank you for your reply. Yes I am using javascript to populate the datagrid columns.

To set the indicator flag I use
dg.CellSetText (0, currRow, "Y");. Currently it is only being set in the onCellChange event which I have verified is fired when I use dg.CellSetText (18, currRow, "Text"); I did try setting the indicator flag on the comments change event. Either way the indicator flag column is set to "Y" and the comments column is updated... until I trigger a WebFocus method.

I would appreciate your samples. My email is deana.goeken@wyo.gov.

Thank you,
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
Gold member
posted Hide Post
Mark,

Thank you for your samples. I was able to play around with your code and add my code until I was able to replicate my error, which led to a solution. If I manually set the row value, the data is retained. However, when I try to set the row dynamically based on the value in text box on the form, the values in the grid were not retained.

original code
var dg = document.form1.Grid2;
var currRow = document.form1.txtLastRow.value;
document.Form1.Grid2.CellSetText (1, currRow , document.Form1.MultiEditBox2.value);
document.Form1.Grid2.CellSetText (0, currRow , "Y"); //sets the indicator field value

I tried changing currRow to grid2.GetCurrentRow using both of the following samples
document.Form1.Grid2.CellSetText (1, grid2.GetCurrentRow(), document.Form1.MultiEditBox2.value);

and
var dg = document.form1.Grid2;
var currRow = grid2.GetCurrentRow();
document.Form1.Grid2.CellSetText (1, currRow , document.Form1.MultiEditBox2.value);
document.Form1.Grid2.CellSetText (0, currRow , "Y"); //sets the indicator field value

Both of the above examples worked for the first time I tried to update the comments or the fund, but the grids current row was resetting to 0 after that. Thus the next time I tried to modify either field, it was always trying to update row 0, instead of the correct row. This behavior is the reason I have a separate control on the form to track my current row to begin with. My solution is:

working code
var dg = document.form1.Grid2;
var lastRow = document.form1.txtLastRow.value;
dg.SetCurrentRow(currRow);
var currRow = dg.GetCurrentRow();
document.Form1.Grid2.CellSetText (1, currRow , document.Form1.MultiEditBox2.value);
document.Form1.Grid2.CellSetText (0, currRow , "Y"); //sets the indicator field value


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     [Solved] Js Grid on Maintain form loses data when returning to webfocus

Copyright © 1996-2020 Information Builders