Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

Highlight multiple days but select only one day #26

Closed
waqas-syed opened this issue Aug 10, 2015 · 4 comments
Closed

Highlight multiple days but select only one day #26

waqas-syed opened this issue Aug 10, 2015 · 4 comments

Comments

@waqas-syed
Copy link

I want to be able to highlight a number of days based on some business logic when the datepicker gets rendered on screen but the user be only able to select one day. So that will probably require that the highlighted days be in a different color(e.g., green) and the selected single day be in another color (e.g., red).

Is this possible? Or even if I can make some edits in the current code to achieve this that would be great!

@mgohin
Copy link
Contributor

mgohin commented Aug 10, 2015

Use the day-click callback to choose to select the date or not.

html

<multiple-date-picker day-click="selectDayIfPossible" highlight-days="highlightDays"/>

js

$scope. selectDayIfPossible = function(event, date) {
    event.preventDefault() // prevent the select to happen
    if(canSelect()){ //check if user can select this date
        date.selected = !date.selected
    }
}
$scope.highlightDays = [
    {date: YOUR_DATE, css: 'mySelectableClass', selectable: true},
];

Then change the css to show dates with default css as not selectable and add css for .picker-day.mySelectableClass (check the example Highlight-days in the demo page)

@waqas-syed
Copy link
Author

Thanks. That does give me a solution.

But now there is another issue, I am not able to 'highlight-days', although I am using the exact procedure specified here : http://arca-computing.github.io/MultipleDatePicker/

None of the specified days is highlighted. Can I get a Plunker/Fiddle for any example? Thanks in advance!

@mgohin
Copy link
Contributor

mgohin commented Aug 11, 2015

Can you show me your code ? (html, js, css)
We can work on it on a plunkr, would be easy to spot the error together

@waqas-syed
Copy link
Author

I have worked around on the issue and got what I wanted for now. Will get
in touch if I see a problem again!

On Tue, Aug 11, 2015 at 1:06 PM, Maelig notifications@github.com wrote:

Can you show me your code ? (html, js, css)
We can work on it on a plunkr, would be easy to spot the error together


Reply to this email directly or view it on GitHub
#26 (comment)
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants