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.
i konow that could be better solved with MAINTAIN. But we do not have a MAINTAIN Liscence. I have to build an editable table where i can add an extra row to enter additional data to the table. Later i will save the changes with a MODIFY command, but that is not such a big thing. The user will call the table and depending on his or her location the table has n rows. So i need to count the rows before hand and tell the javascript after which row the additional row has to appear. My problem is that i got some code, but the script erases a row instead off adding it. Hope that is not to confusing!!! Here is my code!!!
-SET &ECHO=ON;
-? &
-DEFAULTH &STARTAT='DATAGRID';
-DEFAULTH &MATCHKEY='XYZ'
-GOTO &STARTAT.EVAL
-DATAGRID
TABLE FILE CAR
PRINT MODEL
-*WHERE CAR EQ 'BMW'
ON TABLE HOLD AS COUNT1
END
-RUN
-*-EXIT
DEFINE FILE CAR
LOADDATA/A200='<input type=button value="Load" onClick="doLoad();"></input>';
ADDROW/A200='<input type=button value="+/-" onClick="showHide(&LINES);"</input>';
END
TABLE FILE CAR
PRINT
COMPUTE ROWCNT/I2= LAST ROWCNT + 1;
COMPUTE COL1/A200= IF ROWCNT EQ &LINES + 1 THEN '<input type="text" name="COL1" id="R8C1" /> ' ELSE
'<input type="text" name="COL1" id="R'||EDIT(ROWCNT)||'C1" value="'||CAR||'" />' ; AS 'CAR'
COMPUTE COL2/A200= IF ROWCNT EQ &LINES + 1 THEN '<input type="text" name="COL2" id="R8C2" />' ELSE
'<input type="text" name="COL2" id="R'||EDIT(ROWCNT)||'C2" value="'||MODEL||'" />'; AS 'MODEL'
COMPUTE COL3/A200= IF ROWCNT EQ &LINES + 1 THEN '<input type="text" name="COL3" id="R8C3" />' ELSE
'<input type="text" name="COL3" id="R'||EDIT(ROWCNT)||'C3" value="'||BODYTYPE||'" />'; AS 'BODYTYPE'
BY MODEL NOPRINT
ON TABLE HEADING
"<ADDROW"
ON TABLE SUBFOOT
"<LOADDATA"
-*WHERE RECORDLIMIT EQ 8
ON TABLE HOLD AS DATAGRID FORMAT HTMTABLE
ON TABLE SET PAGE NOLEAD
END
-RUN
-HTMLFORM BEGIN
<html>
<head>
<script javascript>
function showHide(onRow){
var doFrom = onRow +1;
var tbl = document.getElementsByTagName('TABLE');
var rows = document.getElementsByTagName('TR');
var nextStyle=rows[doFrom].style.display;
if (nextStyle != 'none'){
for ( i=doFrom; i<20;i++) {
rows[i].style.display='none';
}
}
else
rows[doFrom].style.display='';
}
</script>
</head>
!IBI.FIL.DATAGRID;
</body>
</html>
-HTMLFORM END
Regards
Christian
WF Production Version: 7.7.02M WF Test Version: 7.7.02M Developer Studio: 7.7.02 HTML, EXL2K, FLEX, PDF,PPT
I think FreSte or JG posted some code a while back that did some stuff like this.
- ABT
quote:
Originally posted by ChristianP: Hi Focals,
i konow that could be better solved with MAINTAIN. But we do not have a MAINTAIN Liscence. I have to build an editable table where i can add an extra row to enter additional data to the table. Later i will save the changes with a MODIFY command, but that is not such a big thing. The user will call the table and depending on his or her location the table has n rows. So i need to count the rows before hand and tell the javascript after which row the additional row has to appear. My problem is that i got some code, but the script erases a row instead off adding it. Hope that is not to confusing!!! Here is my code!!!
-SET &ECHO=ON;
-? &
-DEFAULTH &STARTAT='DATAGRID';
-DEFAULTH &MATCHKEY='XYZ'
-GOTO &STARTAT.EVAL
-DATAGRID
TABLE FILE CAR
PRINT MODEL
-*WHERE CAR EQ 'BMW'
ON TABLE HOLD AS COUNT1
END
-RUN
-*-EXIT
DEFINE FILE CAR
LOADDATA/A200='<input type=button value="Load" onClick="doLoad();"></input>';
ADDROW/A200='<input type=button value="+/-" onClick="showHide(&LINES);"</input>';
END
TABLE FILE CAR
PRINT
COMPUTE ROWCNT/I2= LAST ROWCNT + 1;
COMPUTE COL1/A200= IF ROWCNT EQ &LINES + 1 THEN '<input type="text" name="COL1" id="R8C1" /> ' ELSE
'<input type="text" name="COL1" id="R'||EDIT(ROWCNT)||'C1" value="'||CAR||'" />' ; AS 'CAR'
COMPUTE COL2/A200= IF ROWCNT EQ &LINES + 1 THEN '<input type="text" name="COL2" id="R8C2" />' ELSE
'<input type="text" name="COL2" id="R'||EDIT(ROWCNT)||'C2" value="'||MODEL||'" />'; AS 'MODEL'
COMPUTE COL3/A200= IF ROWCNT EQ &LINES + 1 THEN '<input type="text" name="COL3" id="R8C3" />' ELSE
'<input type="text" name="COL3" id="R'||EDIT(ROWCNT)||'C3" value="'||BODYTYPE||'" />'; AS 'BODYTYPE'
BY MODEL NOPRINT
ON TABLE HEADING
"<ADDROW"
ON TABLE SUBFOOT
"<LOADDATA"
-*WHERE RECORDLIMIT EQ 8
ON TABLE HOLD AS DATAGRID FORMAT HTMTABLE
ON TABLE SET PAGE NOLEAD
END
-RUN
-HTMLFORM BEGIN
<html>
<head>
<script javascript>
function showHide(onRow){
var doFrom = onRow +1;
var tbl = document.getElementsByTagName('TABLE');
var rows = document.getElementsByTagName('TR');
var nextStyle=rows[doFrom].style.display;
if (nextStyle != 'none'){
for ( i=doFrom; i<20;i++) {
rows[i].style.display='none';
}
}
else
rows[doFrom].style.display='';
}
</script>
</head>
!IBI.FIL.DATAGRID;
</body>
</html>
-HTMLFORM END
that,s cool and quiete close to my needs. I just want to add the row(s) at the bottom of the table. So i thouhgt i need to count the lines put this value into the js to tell the script where the row has to be placed. In my case the car file has 18 lines and i want to place the row at line 19. But the code adds the row at place 17 th. Played a lot with my friends "try" and "error" but could not solve it!!!
Regards
Christian
WF Production Version: 7.7.02M WF Test Version: 7.7.02M Developer Studio: 7.7.02 HTML, EXL2K, FLEX, PDF,PPT
To add a row, you need to create a new row with content and append it to the table-body. That will automatically place it at the end of your table.
Creating the row is the hard part here (and the code you showed us doesn't look like it does that at all). It goes like this:
var tr = document.createElement('tr');
var cell1 = document.createElement('td');
var cell2 = document.createElement('td');
var cell3 = document.createElement('td');
tr.appendChild(cell1);
tr.appendChild(cell2);
tr.appendChild(cell3);
...and that's just a row with 3 empty cells.
Easier is to use the JQuery framework to do the work for you, like so:
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
Ehrm... id's are supposed to be unique in a HTML page, but you're repeating the same computed field with the same id on every data-row. It's going to be a 'woman of negotiable affection' to reference such checkboxes from Javascript. Perhaps you meant to set the class-attribute instead?
With regards to the checkbox, that's just an input field with it's type set to 'checkbox' and a checked attribute to set it checked (any attribute-value will do). You can copy the necessary bits from the else-block in your addCell function and add the necessary attributes.
(It's good form to add 'type="text"' for the case you're already covering too)
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :