I am using redquerybuilder version 0.6 to create a querybuilder for my application. I downloaded the archive and added the script as per the document. I have a date field to select and query the database. When I select the date field from the field list, the value text is automatically filled with current date value, but the argument will be still null. Also when I change the selected field from date to any other field, the arguments for the current field is updated with date value. Is there any way to set the default value of date field to 'null'. My code is as below:
enter code here
RedQueryBuilderFactory.create({
meta : {
tables : [ {
"name" : "artefacts_log2timeline",
"label" : "Log2Timeline",
"columns" : [ {
"name" : "timezone",
"label" : "Timezone",
"type" : "STRING"
}, {
"name" : "datetime",
"label" : "date",
"type" : "DATE",
"default" : "",
"size" : 10
}, {
"name" : "source",
"label" : "Source",
"type" : "STRING",
//"editor" : "SELECT"
}]
},
onSqlChange : function(sql, args) {
var out = sql + '\r\n';
var query_args = '';
for (var i = 0; i < args.length; i++) {
//console.log('Arg'+args);
//console.log('Sql'+sql);
var arg = args[i];
if (arg == null || arg == '')
arg = ''
if(i != 0){
query_args+=','
/*if(i > 0){
if(arg.toString().indexOf('GMT') > -1 || arg == '')
arg = ''
}*/
}
//console.log(sql)
out += 'arg' + i;
if (arg != null) {
out += ' type=' + Object.prototype.toString.call(arg) + ' toString=' + arg;
} else {
out += ' null';
}
out += '\r\n';
query_args+='args'+i+'='+arg
}
document.getElementById("debug").value = out;
document.getElementById("args").value= query_args;
console.log(document.getElementById("args").value)
//console.log(document.getElementById("debug").value);
},
enumerate : function(request, response) {
if (request.columnName == 'CATEGORY') {
response([{value:'A', label:'Small'}, {value:'B', label:'Medium'}]);
} else {
response([{value:'M', label:'Male'}, {value:'F', label:'Female'}]);
}
}]
},'', '');
Thanks in advance.