Commit ad3ca016 authored by Siong-Ui Te's avatar Siong-Ui Te

better argument passing

parent d271ccf3
......@@ -21,16 +21,16 @@ func getFinalShowLocale() string {
return locale
}
func xmlAction(text, action string) {
func xmlAction(t lib.Tree) {
// FIXME: show loading not working on Chromium
ShowIsLoadingXML(text)
ShowIsLoadingXML(t.Text)
defer HideIsLoadingXML()
mainview := Document.GetElementById("mainview")
// Load the xml file using synchronous (third param is set to false) XMLHttpRequest
myXMLHTTPRequest := NewXMLHttpRequest()
myXMLHTTPRequest.Open("GET", libfrontend.ActionXmlUrl(action), false)
myXMLHTTPRequest.Open("GET", libfrontend.ActionXmlUrl(t.Action), false)
myXMLHTTPRequest.Send()
xmlDoc := myXMLHTTPRequest.ResponseXML()
......
......@@ -5,7 +5,7 @@ import (
"github.com/siongui/gopalilib/lib"
)
func traverseTreeviewData(tree lib.Tree, actionFunc func(string, string)) *Object {
func traverseTreeviewData(tree lib.Tree, actionFunc func(lib.Tree)) *Object {
if len(tree.SubTrees) > 0 {
div := Document.CreateElement("div")
div.ClassList().Add("item")
......@@ -50,7 +50,7 @@ func traverseTreeviewData(tree lib.Tree, actionFunc func(string, string)) *Objec
span.ClassList().Add("treeNode")
span.SetInnerHTML(tree.Text)
span.AddEventListener("click", func(e Event) {
actionFunc(tree.Text, tree.Action)
actionFunc(tree)
})
div.AppendChild(span)
......@@ -85,7 +85,7 @@ func appendCSSToHeadElement() {
Document.QuerySelector("head").AppendChild(s)
}
func NewTreeview(id string, root lib.Tree, actionFunc func(string, string)) {
func NewTreeview(id string, root lib.Tree, actionFunc func(lib.Tree)) {
appendCSSToHeadElement()
treeviewContainer := Document.GetElementById(id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment