Hi,
DavidK was helping me out and had recommended JSTree, which is a jQuery tree control.
I can perform an AJAX callback to get JSON data from the database. I'm really lost on how to properly format the JSON data from the table.
I have basically done the following in my XBasic Function for the callback:
Function cbGetCats as c (e as p)
dim cn as sql::connection
cn.Open("::Name::dbConn")
cn.Execute("select cfgcat_id as id,cfgcat_parentnode as parent, cfgcat_desc as text from cfg_categories")
rs=cn.ResultSet
txt=rs.ToJSONObjectSyntax()
cbGetCats = txt
end Function
I thought this would be enough in my callback but nothing is appearing in JStree, and I cannot figure out how to use FireBug to see what is actually returning, if anything.
I have JSTree being called as:
function doJSTree() {
jQuery('#jstree_div').jstree({
'core' : {
'data' : {
'url' : {dialog.object}.runAction('getTD')
}
}
});
}
getTD is my JavaScript Action, which performs the callback. The callback runs, and I have tested that the database is returning the data properly, because I'll output it to a label.... but it doesn't appear in the totally proper JSON format (it has come back in a variety of ways..sometimes with everything delimited such as \"ID\" etc.. I can't even recall all the ways at this point.
If I manually add the data in the doJSTree function, without using an Ajax callback, the tree populates correctly. I have even taken my database output from the interactive window before (that appeared to be formatted properly) and placed in manually into the doJSTree function, and it worked...
Any hints on how to get the data from the table into JSON format????? THANK YOU
DavidK was helping me out and had recommended JSTree, which is a jQuery tree control.
I can perform an AJAX callback to get JSON data from the database. I'm really lost on how to properly format the JSON data from the table.
I have basically done the following in my XBasic Function for the callback:
Function cbGetCats as c (e as p)
dim cn as sql::connection
cn.Open("::Name::dbConn")
cn.Execute("select cfgcat_id as id,cfgcat_parentnode as parent, cfgcat_desc as text from cfg_categories")
rs=cn.ResultSet
txt=rs.ToJSONObjectSyntax()
cbGetCats = txt
end Function
I thought this would be enough in my callback but nothing is appearing in JStree, and I cannot figure out how to use FireBug to see what is actually returning, if anything.
I have JSTree being called as:
function doJSTree() {
jQuery('#jstree_div').jstree({
'core' : {
'data' : {
'url' : {dialog.object}.runAction('getTD')
}
}
});
}
getTD is my JavaScript Action, which performs the callback. The callback runs, and I have tested that the database is returning the data properly, because I'll output it to a label.... but it doesn't appear in the totally proper JSON format (it has come back in a variety of ways..sometimes with everything delimited such as \"ID\" etc.. I can't even recall all the ways at this point.
If I manually add the data in the doJSTree function, without using an Ajax callback, the tree populates correctly. I have even taken my database output from the interactive window before (that appeared to be formatted properly) and placed in manually into the doJSTree function, and it worked...
Any hints on how to get the data from the table into JSON format????? THANK YOU
Comment