{"action":"created","issue":{"url":"https://api.github.com/repos/volkanceylan/Serenity/issues/1484","repository_url":"https://api.github.com/repos/volkanceylan/Serenity","labels_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/1484/labels{/name}","comments_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/1484/comments","events_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/1484/events","html_url":"https://github.com/volkanceylan/Serenity/issues/1484","id":191196328,"number":1484,"title":"Not an Issue: How to set Initial Value of DateTime QuickFilter","user":{"login":"shaileshbc","id":19570368,"avatar_url":"https://avatars.githubusercontent.com/u/19570368?v=3","gravatar_id":"","url":"https://api.github.com/users/shaileshbc","html_url":"https://github.com/shaileshbc","followers_url":"https://api.github.com/users/shaileshbc/followers","following_url":"https://api.github.com/users/shaileshbc/following{/other_user}","gists_url":"https://api.github.com/users/shaileshbc/gists{/gist_id}","starred_url":"https://api.github.com/users/shaileshbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaileshbc/subscriptions","organizations_url":"https://api.github.com/users/shaileshbc/orgs","repos_url":"https://api.github.com/users/shaileshbc/repos","events_url":"https://api.github.com/users/shaileshbc/events{/privacy}","received_events_url":"https://api.github.com/users/shaileshbc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-23T06:22:08Z","updated_at":"2016-11-23T12:22:41Z","closed_at":"2016-11-23T12:22:41Z","body":"I have added Quick filter for DateTime Field using \r\nthis.addDateTimeRangeFilter(\"xyz\", \"xyz\");\r\nin createQuickFilters method.\r\n\r\nI want to initialise DateTimeQuickfilter with some values.\r\nI tried with following code but it didn't work.\r\n`protected getQuickFilters(): Serenity.QuickFilter<Serenity.Widget<any>, any>[] {\r\n\r\n\t\t\t// get quick filter list from base class\r\n\t\t\tlet filters = super.getQuickFilters();\r\n\t\t\tlet fld = Row.Fields;\r\n\t\t\tvar today = new Date();\r\n\t\t\tvar firstDayofMonth = new Date(today.getFullYear(), today.getMonth(), 1);\r\n\t\t\tQ.first(filters, x => x.field == fld.DateTimeFieldName).init = w => {\r\n\t\t\t\t(w as Serenity.DateTimeEditor).valueAsDate = firstDayofMonth;\r\n\t\t\t\tlet endDate = w.element.nextAll(\".s-DateTimeEditor\").getWidget(Serenity.DateTimeEditor);\r\n\t\t\t\tendDate.valueAsDate = today;\r\n\t\t\t};\r\n\t\t\treturn filters;\r\n\t\t}`\r\nas following code \r\nlet filters = super.getQuickFilters(); \r\ndoesn't return any quickfilter and getting error \r\nlike \"first:No element satisfies the condition.!\".\r\nSo how to set Initial values for DateTimeQuickFilter.\r\nShailesh"},"comment":{"url":"https://api.github.com/repos/volkanceylan/Serenity/issues/comments/262499589","html_url":"https://github.com/volkanceylan/Serenity/issues/1484#issuecomment-262499589","issue_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/1484","id":262499589,"user":{"login":"shaileshbc","id":19570368,"avatar_url":"https://avatars.githubusercontent.com/u/19570368?v=3","gravatar_id":"","url":"https://api.github.com/users/shaileshbc","html_url":"https://github.com/shaileshbc","followers_url":"https://api.github.com/users/shaileshbc/followers","following_url":"https://api.github.com/users/shaileshbc/following{/other_user}","gists_url":"https://api.github.com/users/shaileshbc/gists{/gist_id}","starred_url":"https://api.github.com/users/shaileshbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaileshbc/subscriptions","organizations_url":"https://api.github.com/users/shaileshbc/orgs","repos_url":"https://api.github.com/users/shaileshbc/repos","events_url":"https://api.github.com/users/shaileshbc/events{/privacy}","received_events_url":"https://api.github.com/users/shaileshbc/received_events","type":"User","site_admin":false},"created_at":"2016-11-23T12:22:41Z","updated_at":"2016-11-23T12:22:41Z","body":"Changing code solved by issue.\r\n`let endDate = w.element.nextAll(\".s-DateTimeEditor.dateQ\").getWidget(Serenity.DateTimeEditor);`\r\n\r\nthanks\r\nregards\r\nShailesh"}}
{"actor":{"display_login":"shaileshbc"}}