Please help. I am a newbie to programming and Appgini has really helped me with my learning curve. This time I need a help for the below code. Basically I am trying to create a dedicated button for custom filter. Somehow the below code dosen't work for "AND" function. The code is used in table_name-tv.js
$j(function() {
var someDate = new Date();
var numberOfDaysToAdd = 7;
someDate.setDate(someDate.getDate() + numberOfDaysToAdd);
var dd = someDate.getDate();
var mm = someDate.getMonth() + 1;
var y = someDate.getFullYear();
var newdate = dd + '-'+ mm + '-'+ y;
var someDate1 = new Date();
var dd1 = someDate1.getDate();
var mm1 = someDate1.getMonth() + 1;
var y1 = someDate1.getFullYear();
var currentdate = dd1 + '-'+ mm1 + '-'+ y1;
var filter = {
'FilterField[1]': 9, // change this to the actual index of your date field
'FilterOperator[1]': 'less-than-or-equal-to',
'FilterValue[1]': newdate
'FilterAnd[1]': 'and',
'FilterField[2]': 9, // change this to the actual index of your date field
'FilterOperator[2]': 'greater-than-or-equal-to',
'FilterValue[2]': currentdate
};
var url = 'table_name_view.php?SortField=9&SortDirection=asc&' + $j.param(filter);
$j('<a class="btn btn-lg btn-default btn-danger" href="' + url + '"><i class="glyphicon glyphicon-hourglass"></i>Test 1 Week</a>').prependTo('#top_buttons');
})
Help required, Filtering between two dates
Re: Help required, Filtering between two dates
Solved
I was missing a comma "," in the line
'FilterValue[1]': newdate
All credit goes to Mr. Uday who was very kind to help me
I was missing a comma "," in the line
'FilterValue[1]': newdate
All credit goes to Mr. Uday who was very kind to help me