PDA

View Full Version : Getting count of rows in list after using populate


ABC123

Pat Bremkamp
10-02-2017, 05:54 PM
The typical way I've gotten the number of rows in a list control to display like in a grid is to create a static text control above the list such as
&nbsp;<span id="{dialog.componentname}.JOBLIST.RECORDCOUNT"></span>&nbsp;Projects Listed

However, when populating the list using an sql statement like below in a callback, this doesn't change
if cnx.execute(sql,args)
crs = cnx.ResultSet
json = crs.ToJSONObjectSyntax()
json = strtran(json,crlf(),"," + crlf())
json = "[" + rtrim(json,",") + "]"
js = "var lObj={dialog.object}.getControl('JOBLIST');"+crlf()
js = js+"var _data="+json+crlf()
js = js+"lObj.populate(_data);"
cnx.FreeResult()


This method allows the user to select, for example, all the projects for a person or all active projects or all completed projects using a simple dropdown box, which is great for us, but the static text does not change.

Any list experts that can give me a solution?

Davidk
10-02-2017, 08:44 PM
You could put this into the List Control onListDraw event...


$("{dialog.componentname}.JOBLIST.RECORDCOUNT").innerHTML = data.length;

Pat Bremkamp
10-02-2017, 08:55 PM
Perfect. Thanks David.