Hi, I enabled smart rendering, the issue I am having is that when I scroll the next portion of the records is not rendered in the grid, I scroll up and down but I only see the data in the first 50 rows.
Can someone please help me?
Thanks!
Grid Initialization …
<script>
var dhxLayout;
var dhxForm;
var dhxGrid;
var dhxCombo;
var fileID;
var ImgPath = "dhtmlx/imgs/";
var gridQString = "resources/mapaddress/address_search_results.hcst";
window.dhx_globalImgPath="dhtmlx/imgs/";
function sendFormRequest(){
dhxGrid.loadXML(gridQString);
}
function buildGrid()
{
dhxGrid = dhxLayout.cells("b").attachGrid();
dhxGrid.setImagePath(ImgPath);
dhxGrid.setHeader("Address No,Road Name,Type,Direction,Municipality,Legal Unit,Qualifier,Postal Code");
dhxGrid.setInitWidths("100,200,100,80,150,100,100,100");
dhxGrid.setColAlign("left,left,left,left,left,left,left,left");
dhxGrid.setSkin("dhx_skyblue");
dhxGrid.init();
dhxGrid.enableSmartRendering(true);
}
function buildAddressLookUpUI()
{
buildLayout();
buildForm();
buildGrid();
}
dhtmlxEvent(window, "load", buildAddressLookUpUI);
Java method:
public void getAddressGridResults() throws DataException, ServiceException, NumberFormatException
{
m_binder.putLocal(“StatusMessage2”, “Executed getAddressGridResults oct 23 at 10:00”);
String sql = null;
// define variables from incoming values
int posStart = getIntValue("posStart");
int count = getIntValue("count");
if (posStart == -1) posStart = 0;
if (count == -1) count = 50;
// get number of records
String total_count="";
// if posStart is 0 then this is the first query
// if this is the first query - get total number of records
if (posStart == 0) {
sql = "SELECT Count(*) FROM VW_MAP_ADDRESS";
try {
ResultSet rsTotalRecords = m_workspace.createResultSetSQL(sql);
try {
if(rsTotalRecords != null && !rsTotalRecords.isEmpty()) {
total_count = String.valueOf(Integer.parseInt(rsTotalRecords.getStringValue(0)));
}
} catch (NumberFormatException e) {
SystemUtils.err(e, "OttawaRMSAddressLookUp [getting total_count]" + e.getMessage());
}
} catch (DataException e) {
SystemUtils.err(e, "OttawaRMSAddressLookUp [creating total_count ds ]" + e.getMessage());
}
}
// store total_count and posStart in local variable
// these variables are retrieve in address_search_results.hcst
m_binder.putLocal("pos", String.valueOf(posStart));
m_binder.putLocal("total_count", String.valueOf(total_count));
// add limits to query to get only rows necessary for output, taking into account posStart and count
sql = "SELECT MAP_ADDRESS_ID, ADDRESS_NUMBER, ROAD_NAME, RT_ROAD_TYPE_ABBREV, " +
"RT_CARDINAL_DIRECTION_ABBREV, MUNICIPALITY_NAME, LEGAL_UNIT, ADDRESS_QUALIFIER, POSTAL_CODE " +
"FROM " +
"( " +
"SELECT MAP_ADDRESS_ID, ADDRESS_NUMBER, ROAD_NAME, RT_ROAD_TYPE_ABBREV, " +
"RT_CARDINAL_DIRECTION_ABBREV, MUNICIPALITY_NAME, LEGAL_UNIT, ADDRESS_QUALIFIER, POSTAL_CODE, ROWNUM r " +
"FROM " +
"( " +
"SELECT MAP_ADDRESS_ID, ADDRESS_NUMBER, ROAD_NAME, RT_ROAD_TYPE_ABBREV, " +
"RT_CARDINAL_DIRECTION_ABBREV, MUNICIPALITY_NAME, LEGAL_UNIT, ADDRESS_QUALIFIER, POSTAL_CODE " +
"FROM VW_MAP_ADDRESS " +
") " +
"WHERE ROWNUM <= " + String.valueOf(count) +
") " +
"WHERE r >= " + String.valueOf(posStart);
//create object to store address results set
DataResultSet dsAddresses = new DataResultSet();
if(SystemUtils.m_verbose){
SystemUtils.trace("OttawaRMSAddressLookUp",sql);
}
// Execute the query, only get those necessary for the output
try {
ResultSet temp = m_workspace.createResultSetSQL(sql);
dsAddresses.copy(temp);
} catch (DataException e) {
SystemUtils.err(e, "OttawaRMSAddressLookUp [getting addresses]" + e.getMessage());
} finally {
// Release database connection
m_workspace.releaseConnection();
}
if (dsAddresses != null && !dsAddresses.isEmpty()) {
m_binder.addResultSet("rsAddressLookup", dsAddresses);
if(SystemUtils.m_verbose){
SystemUtils.trace("OttawaRMSAddressLookUp","End binding dsAddresses to resultset rsAddressLookup");
}
SystemUtils.trace("OttawaRMSAddressLookUp", "Error retrieving cached search data from database!");
}
}
Template that generate the XML:
<?xml version='1.0' encoding='iso-8859-1'?><$executeService(“RETRIEVE_ADDRESS_LIST2”)$>
<$loop rsAddressLookup$>
<$xml(rsAddressLookup.ADDRESS_NUMBER)$>
<$xml(rsAddressLookup.ROAD_NAME)$>
<$xml(rsAddressLookup.RT_ROAD_TYPE_ABBREV)$>
<$xml(rsAddressLookup.RT_CARDINAL_DIRECTION_ABBREV)$>
<$xml(rsAddressLookup.MUNICIPALITY_NAME)$>
<$xml(rsAddressLookup.LEGAL_UNIT)$>
<$xml(rsAddressLookup.ADDRESS_QUALIFIER)$>
<$xml(rsAddressLookup.POSTAL_CODE)$>
<$endloop$>