I have a UX with a List Control called MARKETINGLIST, based on a mySQL table.
I am populating the list with data from an xbasic function, following the video example in "How to query a SQL database with Ajax to populate a list control."
http://www.alphasoftware.com/video-l...search=list%20
However, my application has a detail view, and a search part using Query By Form, and the example in the video does not.
I set the list to use static data, and used the table column headings as the static data, in order to define the layout for the list.
I have the xbasic function below, which populates the list.
It works like a charm, the list populates as expected, along with the detail view controls. I can navigate and edit records and save data.
The problem is in the Query By Form. The Search does not execute.
I have this on the Search button: {dialog.object}.getControl('MARKETINGLIST').searchList({searchMode : 'auto'});
I have also tried forcing it to a client-side search: {dialog.object}.getControl('MARKETINGLIST').searchList({searchMode : 'clientSide'});
Is there some reason that the .searchList() method will not work in this scenario?
Here is the code I am using to populate the list, although I don't think it has anything to do with the problem:
I am populating the list with data from an xbasic function, following the video example in "How to query a SQL database with Ajax to populate a list control."
http://www.alphasoftware.com/video-l...search=list%20
However, my application has a detail view, and a search part using Query By Form, and the example in the video does not.
I set the list to use static data, and used the table column headings as the static data, in order to define the layout for the list.
I have the xbasic function below, which populates the list.
It works like a charm, the list populates as expected, along with the detail view controls. I can navigate and edit records and save data.
The problem is in the Query By Form. The Search does not execute.
I have this on the Search button: {dialog.object}.getControl('MARKETINGLIST').searchList({searchMode : 'auto'});
I have also tried forcing it to a client-side search: {dialog.object}.getControl('MARKETINGLIST').searchList({searchMode : 'clientSide'});
Is there some reason that the .searchList() method will not work in this scenario?
Here is the code I am using to populate the list, although I don't think it has anything to do with the problem:
Code:
function populateList as c (e as p) dim js as c dim flag as l dim sql as c dim cn as sql::Connection dim args as sql::Arguments flag = cn.open("::Name::FreightzoneMySql") if flag = .f. then js = "alert('Could not connect to database. Error reported was: ' + '" + js_escape(cn.CallResult.text) + "');" GoTo endpopulateList end if sql = <<%txt% SELECT Marketing_ID, CreateDate, ModifyDate, User_FK, Company_IDFK, CompanyName, Address1, Address2, City, ST, Zip, PrimaryContact, Phone, Fax, Cell, Email, Website, Notes1, Notes2, Outcome, DNUreason, DateCalled, CallBackDate, FullTruckloadYN, LTLYN, VansYN, FlatsYN, ReefersYN, HotYN, Source, Caller, BeenCalledYN, IsBlankDateCalledYN FROM marketing %txt% flag = cn.execute(sql,args) if flag = .f. js = "alert(populateList cn.execute(sql,args)ONE failed.');" goto endpopulateList end if dim rs as sql::ResultSet rs = cn.ResultSet dim json as c json = rs.ToJSONObjectSyntax() json = stritran(json,crlf(),"," + crlf()) json = "[" + rtrim(json,",") + "]" js = "var lObj = {dialog.object}.getControl('MarketingList');" + crlf() js = js + "var _data = " + json + crlf() js = js + "lObj.populate(_data);" endpopulateList: populateList = js cn.FreeResult() delete rs cn.Close() end function