I am new to ajaxed but I'm hoping it will help me in my devlopment
work. I am trying to build a page that displays a list of records
from a table called campaign. I also want to put a dropdown on the
page with the options "ALL", "Active", and "Inactive". When the user
chooses one of the options in the dropdown, I want the records in the
table to be filtered depending on what was selected. The table
displays the first time but disappears on callback. From the logs I
can see that the select query isn't run on callback for some reason.
Here is my code:
<!--#include virtual="/ajaxed/ajaxed.asp"-->
<!--#include virtual="../ajaxed/class_dropdown/dropdown.asp"-->
<!--#include virtual="/ajaxed/class_datatable/datatable.asp"-->
<%
set dt = new Datatable
set page = new AjaxedPage
page.draw()
sub init()
lib.logger.info "init() START"
dt.name = "campaignList"
dt.fullsearch = false
dt.sql = "SELECT * FROM campaign where active = " & selectedStatus
()
call dt.newColumn("campaignid", "Id")
call dt.newColumn("campaignname", "Name")
call dt.newColumn("active", "Active")
dt.sort = "campaignid"
dt.recsPerPage = 20
lib.logger.info "init() END"
end sub
sub callback(a)
lib.logger.info "callback() START"
dt.draw()
lib.logger.info "callback() END"
end sub
sub drawStatusDD()
lib.logger.info "drawStatusDD() START"
set dcText = (new DataContainer)(array("Active", "Inactive"))
set dcValues = (new DataContainer)(array(1, 0))
with new Dropdown
.name = "statusDD"
.datasource = dcText.data
.valuesDatasource = dcValues.data
.selectedValue = selectedStatus()
.attributes = "onchange=""ajaxed.callback('GetCampaigns',
'campaignListx')"""
.draw()
end with
lib.logger.info "drawStatusDD() END"
end sub
sub pagePart_GetCampaigns()
lib.logger.info "pagePart_GetCampaigns() START"
dt.draw()
lib.logger.info "pagePart_GetCampaigns() END"
end sub
function selectedStatus()
lib.logger.info "selectedStatus() START"
status = page.RFP("statusDD", -1)
if status = -1 then
status = 0
end if
lib.logger.info "status is " & status
selectedStatus = status
lib.logger.info "selectedStatus() END"
end function
sub main()
lib.logger.info "main() START"
%>
<form id="frm">
<div><% drawStatusDD() %></div>
<div id="campaignListx"><% pagePart_GetCampaigns() %></div>
</form>
<%
lib.logger.info "main() END"
end sub
%>