Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved] Maintain Js Grid dropdown not working
Go
New
Search
Notify
Tools
Reply
  
[Solved] Maintain Js Grid dropdown not working
 Login/Join
 
Gold member
posted
In my 7703 application, I am trying to add a drop-down list to a js grid.

Based on a previous post [SOLVED by IB] help with maintain JS Grid dropdown- character limit?, I have the following code:

Maintain
Compute R/I11=1;
Compute List1/A0= ' ';
repeat StkAssessmentType.FocCount
compute List1 = List1 || StkAssessmentType(R).SCOREDESCRIPTION | ',';
compute R=R+1;
endrepeat

javascript for OnGrid1_OnRowChange:
var DynamList=document.frmDetail.EditBox1.value;
// Replace the "," with "\n"
var myRegExp = /,/gi;
DynamList=DynamList.replace(myRegExp,"\n");
document.frmDetail.Grid1.GetCell(2,newRow);
document.frmDetail.Grid1.QuickSetCellType(2, newRow, 1);
document.frmDetail.Grid1.QuickSetLabel (2, newRow, DynamList);

List1 is correctly bound to an editbox on my form. To debug the javascript, I placed alerts after each line. The javascript appears to work until it reaches document.frmDetail.Grid1.GetCell(2,newRow); when it stops returning the alert statements.


Any clues on how to get the drop-down list to overlay the grid?

Thank you, 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: 82 | Registered: March 19, 2011Reply With QuoteReport This Post
Master
posted Hide Post
Deana
This technique uses HTML to create the drop down list in the JS Grid. This is a static list but we could create a dynamic list as well.

Notice that when a selection is made, we perform a JS function called getval. I have included that function at the end of the code. It copies the selection into the answer field.

Your JS Grid should have a column called app that is Content Type HTML and another column, Answer, for the selection to reside.

My example has App in column 2 and Answer in column 3. If you move the columns you will have to adjust saver / getval. If you would like this example please send me your email and I will send it to you.

Mark

MAINTAIN FILE empdata

$$Declarations

Case Top
for 10 next pin into stk
compute i/i2=1;
repeat stk.foccount
  
compute stk(i).app/a300 = 
  "<select onchange='getval[this, " || I ||")' name=list " || I || ">" |
		"  <option value=' '>  </option> 		"  |
		"  <option value='Approve'>Approve</option> 		"  |
		"  <option value='Wait'>Wait</option> 		"  |
		"  <option value='Reject'>Reject</option> 	" |
		"</select>";

compute i=i+1;
endrepeat
Winform Show Form1;
EndCase

case saver
compute i=1;
repeat stk.foccount
Compute Stk(I).answer/a10 = Form1.GetHTMLField('list' || I);
compute i=i+1;
endrepeat
endcase

END

saver.js

function getval(sel, I)
{
Form1.Grid1.CellSetText(2, I-1, sel.value);
Form1.Grid1.CellSetText(3, I-1, "Y");
}
 
Posts: 661 | Location: New York | Registered: May 08, 2003Reply With QuoteReport This Post
Gold member
posted Hide Post
Mark,

The code samples you sent worked great. I am looking forward to using this functionality as I move forward with my project.

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: 82 | Registered: March 19, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved] Maintain Js Grid dropdown not working

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.