Appframe Knowledge Base


1 hits
0

How to use the filter object in javascript

// some variables to be used as part of filter criteria
var vCurrentMonday = new XDate(+$("#weeks").val()),
	vOrderItem = $("#orders").val();

// defining the filter object
dsTimesheet.setParameter("filterObject", {
	type: "group", mode: "and", items: [
		{ type: "expression", column: "WeekStarting", operator: "equals", valueType: "datetime", value: vCurrentMonday },
		{ type: "expression", column: "OrderItemTemplate", operator: "equals", valueType: "string", value: vOrderItem }
	]
});

// refresh the data source to get data using the filter
dsTimesheet.refreshDataSource();

// Alternatively you can build the filter string yourself,
// but then you need to make sure you escape and format the values properly
dsTimesheet.recordSource.setFilterString("WeekStarting = '" + af.common.formatByMask(vCurrentMonday, "sql_date_time") + "' AND OrderItemTemplate = '" + vOrderItem.replace(/'/g, "''") + "'");

components dataobject web · Perma link post comment Posted by: Torgeir Fredriksen (29-nov-2012)