I'm working on customizing react-calendar and found an edge case where for some reason even though I pass in the selectRange prop as true to the calendar, the entire range of dates between the start and end date don't get selected. I noticed for the dates in between the start and end, the button attribute reads as react-calendar__tile and doesn't have the --active suffix, which is causing them to show up as unselected. Is there a way to manually set this? It doesn't append it to the right place when I pass in --active via tileClassName.
Photo for reference:
It's working well with me, you can check it online from here. Also, you can replace the native class of the --active one with yours.
Related
Odoo 13.
I got two float fields: time_given and timer.
I have created a widget for 'timer' field. My widget works as real-time clock or some sort of timer. The problem I have encountered is that I want to change the style of 'time_given' field based on the following condition:
((time_given - timer) <= 30 sec) i.e less than 30 seconds left
To change the style of the field the widget attached to is pretty easy, but I am not sure hot to get access to other field elements in the form view I need and make some visual manipulations with them if needed.
I was able to get access to other field elements, change their style and add some text but the it is not a proper way.
this.__parentedParent.__parentedChildren
I get array of objects, then I loop through it and look for the field needed. After I found my target field element I am able to play with it.
For example:
$field_name.addClass('text-danger')
The way above works pretty fine but again as I said before, this is definitely not a proper way.
I was trying to find the right field element and add class to it by the following way:
$("[name='field_name']").addClass('text-danger')
It found the element, but did not add the class 'text-danger'.
I was trying my best by googling and reading the source code, but failed.
enter image description here
I have managed to solve this issue. Just used core.bus.trigger method mentioned in the official documentation.
P.s. In case if you are still interested how I did this in more details, just let me know in the comments section below.
I'm using FullCalendar and allowing the user to make selections to create off-times. Is it possible to allow selecting multiple days, but instead of the standard behavior:
select only the rectangle between the start and end time.
Desired behavior:
I'm OK with still having one Start date/time and one End date/time. I don't need an array of selections (one per each day selected) as I'm handling that fine in the backend already.
Using FullCalendar v3.9.0.
It's not possible to do this with FullCalendar as-is. I've changed the code to support such option.
Please refer to the following issue, in the initial message a Patch is attached for v3.9.0 of the calendar:
https://github.com/fullcalendar/fullcalendar/issues/4119
I'm using the ck-editor(4.4.6). In Ck-editor's textarea I want to update my text, for that I use setData("hai"); that text updating correctly but some plugin functionality not working after use this setData(); (eg. restrict multiple enter if I reload the page it's working correctly).
editorInstance.setData("test text");
Anyway first time and after reload the page it working fine.
ruby on rails with jquery things are I'm using.
How can I solve this?
I don't know about ck-editor(4.4.6) but i can give you a way to solve it. You have to use based on your parent class. First time it works because it was same but after that it did't find the class/your specific term/attribute. So you have to use by calling parent class/id and under your activity.
You will need to call the update element function after setting the data, this will actually set the value in the field.
And, also you will need to specify the id of the textarea as given below.
CKEDITOR.instances.id_of_textarea.setData('hai');
CKEDITOR.instances.id_of_textarea.updateElement();
Finally, I got the answer instead of set data I just add my content to CKEditor text area as link this its working fine:
$('#cke_editor1 iframe').contents().find('body').html("Your text");
I have a form where I can edit event information for a calendar. These specific events run every single week, but one of the form fields is for "days off" where you can enter days where the event doesn't run. using mysql and php, any current days off will be displayed in a textarea field, separated by spaces. You will also be able to put in more days off by typing in a date and making spaces. I would like to be able to style each date just like right here on stack overflow when you ask a new question and put in the tags. After you type in a tag, it gets surrounded by a box, turns blue, and gets an x for deleting it. This is what I want.
Here's a link to a screenshot of what I want it to look like.
http://www.uvm.edu/~sass/screenshot.jpg
I'm not sure how it works with dates and formatting them, but as for displaying in such style I've been using Select2 component. If you can add parsing or create valid list of dates it should give you the correct result.
Okay, I have found a solution by digging around the internet.
Stack Overflow style tagging system in jquery (view the second answer)
Someone created exactly what I want. The results are stored in a hidden field as a comma separated list so I can easily explode it into an array for use with my database, and it formats the inputs nicely with css. I modified the look with css and changed the accepted formats to work with dates and here is the result.
http://www.uvm.edu/~sass/screenshot.png
The values in the column filter show properly the first time being opened. Issue comes from the second time onward after adding or deleting the values, filter values in the box are not refreshed (see screenshot below).
After a lot of trial and error, I found that if you run the following function it will give mostly the desired result. I am running this on any change event for the given column.
var filterInstance = gridApi.getFilterInstance('yourColumn');
filterInstance.resetFilterValues()
The bug still needs to be fixed by ag-grid, but this is a decent workaround. It would be good to add some logic to maintain any existing filter selections, but for the time being it fits my purposes. If anyone has a better approach, do let me know. :)