The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Add External jscript to html document
jrd
post Aug 15 2020, 12:01 PM
Post #1





Group: Members
Posts: 2
Joined: 15-August 20
Member No.: 27,495



I'm working on an html table in which I want to add search functionality and title row freezing (row 1 always visible).
The document I'm working on uses this to build the html table, the data is generated by a query which is run previously.
CODE

quote = chr(34)
crlf = chr(13) & chr(10)

fnArrToHtmlError = ""
fnArrToHtmlStatus = true

'** validate data array
numDataCells = Ubound(fnArrToHtmlDataArray) 'count all cells
IF ( ( numDataCells = 0) OR (numDataHeaderCells = 0) ) THEN
fnArrToHtmlError = "dataArray empty"
fnArrToHtmlStatus = false
RETURN
ENDIF
status = clearArray("tempArray")
status = ArraySubset(fnArrToHtmlDataArray, "tempArray", 1, 1, 1, 99999999) ' get the first row of the array
numDataCols = Ubound(tempArray) 'count all cells in the first row (to get array width)

'** validate optional data header array
numDataHeadersCells = Ubound(fnArrToHtmlDataHeadersArray) 'count all cells
numDataHeaderRows = Ubound(fnArrToHtmlDataHeadersArray,1 ) 'count number of columns
IF ( ( numDataHeaderRows <> 1) OR (numDataHeaderCells = 0) ) THEN
haveHeaders = false 'must have same number of cols as data array
ELSE
haveHeaders = true
ENDIF

'** if showing headers check number of cols in header and data match
IF ( ( haveHeaders) AND ( Len(numDataHeadersCells) <> Len(numDataCols)) )THEN
    fnArrToHtmlError = "data and headers have different number of columns"
    fnArrToHtmlStatus = false
    RETURN
ENDIF

'** validate title
IF (fnArrToHtmlTitle = "fnarrtohtmltitle" ) THEN
    fnArrToHtmlTitle = ""
ENDIF
IF (fnArrToHtmlTitle <> "" ) THEN
    haveTitle = TRUE
ELSE
    haveTitle = FALSE
ENDIF
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
htmlString = ""
'** add optional title
IF (haveTitle) THEN
    htmlString = htmlString & "<b>" & fnArrToHtmlTitle & "</b>"
    htmlString = htmlString & "<br><br>"
ENDIF

'** add table format
htmlString = htmlString & "<table border=" & quote & "1" & quote & " cellspacing =" & quote & "0" & quote & " cellpadding =" & quote & "5" & quote & ">"

'** add optional table headers
IF (haveHeaders) THEN
        htmlString = htmlString & "<tr>"
    FOR col = 1 to Ubound(fnArrToHtmlDataHeadersArray)
        thisHeader = fnArrToHtmlDataHeadersArray[1, col]
        htmlString = htmlString & "<th>" & thisHeader & "</th>"
    NEXT 'col
    htmlString = htmlString & "</tr>"
ENDIF

[color=#FF6666]'Add js source information THIS IS NOT WORKING[/color]
htmlString = htmlString & "<script src=""../jquery.fixedheadertable.js""></script>"
'htmlString = htmlString & <script src="js/arr2html_js/jquery.fixedheadertable.min.js"></script>
'htmlString = htmlString & <script src="js/arr2html_js/jquery.mousewheel.js"></script>

'** create table of data
IF (Ubound(fnArrToHtmlDataArray) = 1) THEN
    dataHtmlString = ArrayToCSVString(fnArrToHtmlDataArray, "</td></tr><tr><td>") 'seperate cells with end cell/row, start row/cell"
    dataHtmlString = stringReplace(dataHtmlString,"<td></td>", "</td> <td>") 'fix empty cells (replace with non breaking space)
    dataHtmlString = "<tr><td>" & dataHtmlString & "</td></tr>" ' add table/data start and data/table end
ELSE
    dataHtmlString = ArrayToCSVString(fnArrToHtmlDataArray, "</td><td>") 'seperate cells with "end cell/start cell"
    dataHtmlString = stringReplace(dataHtmlString, crlf, "</td></tr><tr><td>") 'add "end cell/row, start row/cell" to end each line
    dataHtmlString = stringReplace(dataHtmlString,"<td></td>", "</td> <td>") 'fix empty cells (replace with non breaking space)
    dataHtmlString = left(dataHtmlString, (len(dataHtmlString) - len("<tr><td>"))) 'remove "start row/cell" added previously from the end)
    dataHtmlString = "<tr><td>" 'add "start row/cell" to the beginning
ENDIF

'** add table to html
htmlString = htmlString & dataHtmlString---------------------------------------------------------------------------------------------------------------------------------------------------

windowWidth = 1000
windowHeight = 600
buttonLabelsArray[1] = "OK"
buttonLabelsArray[2] = "CSV"
buttonLabelsArray[3] = "Print"

buttonIndex = OpenHtmlDisplayDialog(htmlString, windowWidth, windowHeight, buttonLabelsArray)


I have tried various places and syntax's, but it always throws an error when it hits the js source information line.

The js is located here: E:\LABWARE_DEV\SERVER\COMMON\VISUALWORKFLOWS\js\

Where should I add the source and how should I format the line?

Thanks,
Jeff
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
jrd
post Aug 15 2020, 02:23 PM
Post #2





Group: Members
Posts: 2
Joined: 15-August 20
Member No.: 27,495



The jscript files are on a server, it's just noted as E drive. The language I'm using is lims basic, it will accept html and jscript but not php. The two with missing single quotes are commented out.

For purposes of this issue, just assume I'm only dealing with htmland javascript. Also, this is not being displayed in a web browser, just the labware application which is written in smalltalk.

Not sure if that helps clarify or not?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 02:58 PM