I have a issue with the smartgwt calendar tool, I've customized it to assign special icon flags certain days in the month through the protected method getdaybodyhtml() of the class calendar, everything works fine except for one thing when I display the calendar on chrome(all versions) IE(7,8,9) and FF(till 14.0.1), but when I display the calendar on FF(between 15 to 19) this flags icons aren't displayed. I've made a follow to the code and I found that the html code that I defined there in the getdaybodyhtml() method is not printed.
I was looking on the smartgwt for any issue like that but i don't found anything related.
Any help would be received.
(sorry if my english is not so good, is my second language)
Here is the piece of code:
private Calendar calendar = new Calendar(){
#Override
#SuppressWarnings("deprecation")
protected String getDayBodyHTML(Date date, CalendarEvent[] events, Calendar calendar, int rowNum, int colNum) {
String value = defaultMessage != null ? defaultMessage : date.getDate()+"";
// The "events" are the events of the day
List<CalendarEvent> calendarEvents = new ArrayList<CalendarEvent>(Arrays.asList(events));
if(calendarEvents != null && calendarEvents.size() > 0) {
// Removing the tooltip and the excluded colours
removeTooltipsFromCalendar(calendar,date);
removeExcludedColoursFromCalendar(calendarEvents);
if(calendarEvents.size() == 1){
// Description contains the colour
String colour = calendarEvents.get(0).getDescription();
value = imgHTML(COASTAL_IMAGES_DIR+colour+COASTAL_IMAGE_SUFFIX, colourWidth, colourHeight, "images", "class='handCursor'", null);
}else if(calendarEvents.size() > 1){
// Might have two vessels going to the same port in the same day
Set<String> colours = new HashSet<String>();
for(CalendarEvent event : calendarEvents){
// Description contains the colour
colours.add(event.getDescription());
}
int numberOfPorts = colours.size();
for(String colour : colours){
value += "<div>";
value += imgHTML(COASTAL_IMAGES_DIR+colour+COASTAL_IMAGE_SUFFIX, colourWidth, colourHeight/numberOfPorts, "images", "class='handCursor'", null);
value += "</div>";
}
}else{
value = defaultMessage != null ? defaultMessage : date.getDate()+"";
}
}
return value;
}
};
PD: In all the versions of chrome and IE the piece of code:
value += "<div>";
value += imgHTML(COASTAL_IMAGES_DIR+colour+COASTAL_IMAGE_SUFFIX, colourWidth, colourHeight/numberOfPorts, "images", "class='handCursor'", null);
value += "</div>";
is printed ok, in fire fox till the 14 version it's printed ok, but in ff from 15 to 19 not prints the "div" and the "image". I already see the code throw firebug and the div just not apear in that firefox version(15-19).
PD: it doesn't work on last update of IE 10 too.
Are you able to see icons in following sample in SmartGWT showcase.
I'm able to see icons in above sample for April 2, April 3, April 4 and April 5 as of March 31.
CalendarEvent instances used in this sample are created for 2, 3, 4 and 5 days ahead of current date.
I'm using FireFox 19.0.2
Finally I found the issue. I don't know why but in the resent versions of Firefox, after 14 version, the gwt calendar(v 2.1) is repeating the printing of the calendar twice automatically, so when it prints the second time, it did it without the images inside the day bodies.
Solution: manually creation of code to stop the twice printing.
Related
This question already has an answer here:
Cypress - calendar change month, until specific month is found
(1 answer)
Closed last month.
I have a date picker where I want to click the left arrow till I go to April 2022.
First I will open the calendar and then I am using a loop. Here I am going to check whether the selected month is April, if not I am going to continue to click the left arrow. Please tell me whether this is correct.
myFunction() {
for (let i = 1; i <= 11; i += 1) {
cy.get('[style=""] > .CalendarMonth > .CalendarMonth_caption').should('have.text','April 2022')
cy.get('.DayPickerNavigation_leftButton__horizontalDefault > .DayPickerNavigation_svg__horizontal').click()
}
}
We cannot use Loops in cypress. However we can create methods similar to that. I had similar issue where I have to select a date range i.e. start and end date and click download. We have to create recursive method to navigate through months till we get the month we need.
Here is the method I created:
const curr_month = ["January","February","March","April","May","June","July","August","September","October","November","December"];
const d = new Date();
let name = curr_month[d.getMonth()];
cy.log("Name of Current Month" +name);
// ABOVE CODE WILL GIVE YOU CURRENT MONTH VALUE TO COMPATE LATER IN IF BLOCK
var monthNow;
// To go into previous months till september and select September 1
function changeMonth() {
cy.get(<CSS selector till, it contains the text of Month>).then((monthValue) => {
monthNow = monthValue.text();
cy.log("Month VALUE is " +monthNow);
if(monthNow.toLowerCase() != "september") //i have to reach till September
{
cy.get(<LEFT Arrow CSS Selector>).click();
cy.log("Left Arrow Clicked on Calendar");
changeMonth(); //Till it does not reach September, keep making recursive calls
}
else
{
cy.log("September Month Active");
}
}) //closing then
} // closing function
Hope this helps, if you still need it.
Why not using the each class from Cypress.
it('Navigating questions until 33 from bottom arrows works correctly: OK', ()=> {
let answers = [];
answers.length = 33
cy.wrap(answers).each((num, i, array) => {
cy.get('[data-cy="exam-bottom-right-nav"]').click({force: true});
});
cy.wrap(answers).each((num, i, array) => {
cy.get('[data-cy="exam-bottom-left-nav"]').click({force: true});
});
});
I use the DHTMLX Scheduler in Timeline view for a project and the working hours are from 7AM to 5PM. I was able to make an AM/PM view per day but the first_hour and last_hour configs are not respected in the view. The screenshot shows more. The first event in the morning should be displayed far more left as it starts at 7:30Am.
My config:
scheduler.locale.labels.timeline_tab = "Timeline";
scheduler.locale.labels.section_custom = "Section";
scheduler.config.dblclick_create = false;
scheduler.config.edit_on_create = false;
scheduler.config.details_on_dblclick = false;
scheduler.config.details_on_create = false;
scheduler.config.start_on_monday = true;
scheduler.config.first_hour = 7;
scheduler.config.last_hour = 17;
scheduler.config.full_day = true;
scheduler.config.mark_now = false;
scheduler.config.drag_move = false;
scheduler.config.drag_resize = false;
//===============
//Configuration
//===============
scheduler.createTimelineView({
name: "timeline",
x_unit: "hour",
x_date: "%A",
x_step: 12,
x_size: 14,
x_start: 0,
x_length: 14,
y_unit: scheduler.serverList('teams'), // sections and events from same ajax call
y_property: "team_id",
render: "bar",
section_autoheight: false,
dy: 30,
dx: 100,
// first_hour: 7,
// last_hour: 17,
second_scale: {
x_unit: "day", // unit which should be used for second scale
x_date: "%D %j %M"
}
});
Any help will be appreciated.
EDIT:
After update based on the answer here the result:
first_hour, last_hour configs applied for Y-axis in Day, Week, Units views (check Documentation).
Currently, to hide hours at the beginning and end of the day in the Timeline view, you should have only 1 X-axis like in this sample. I.e. visible part of the event is from 10 to 18 because of first_hour, end_hour properties of createTimelineView method. Check the screenshot.
There is also ignore_[viewName] function which can be used to hide interval that equal to min step of the scale (12 hours in your case).
This could help solve your issue if set min step = 6 (hours) and disable 6-7 AM and 5-6 PM by addMarkedTimespan. I tried to create a snippet for you http://snippet.dhtmlx.com/46ba545ad , but found out that the second part of this condition if(date.getHours() < 6 || date.getHours() > 17){ is not working correctly. The event can be created until 6 PM. We will fix it ASAP, but now I can't specify the exact time. I suggest you use the first way with 1 scale to solve the issue.
I have an Android Wear app that fetches calendar events via WearableCalendarContract. It works great when paired with Android phones, but I recently discovered a bug when pairing with an iOS device using the Apple Calendar, in that it would not fetch event colors.
After some investigation, it looks to me like the Apple Calendar doesn't let users give individual calendar events different colors - however, it does let them create different calendars, each with their own individual color. Problem is, my WearableCalendarContract query doesn't seem to fetch the calendar colors either.
Is there a solution to this issue, or am I just going to have to set a default color if no color is found?
Code is below. Thanks!
final long currentTime = System.currentTimeMillis();
Uri.Builder builder = WearableCalendarContract.Instances.CONTENT_URI.buildUpon();
ContentUris.appendId(builder, currentTime - DateUtils.DAY_IN_MILLIS);
ContentUris.appendId(builder, currentTime + DateUtils.DAY_IN_MILLIS);
final String[] PROJECTION = {
CalendarContract.Calendars._ID, // 0
CalendarContract.Instances.BEGIN, // 1
CalendarContract.Instances.END, // 2
CalendarContract.Events.EVENT_COLOR, // 3
CalendarContract.Events.TITLE, // 4
CalendarContract.Events.ALL_DAY, // 5
CalendarContract.Events.CALENDAR_COLOR, // 6
CalendarContract.Events.DISPLAY_COLOR // 7
};
final Cursor cursor = getContentResolver()
.query(builder.build(),
PROJECTION,
null, // selection (all)
null, // selection args
null); // order
I am using a dropDownList to show some values in order to filter results on a grid.
I have use the 'change' event to see when the grid must be updated
$('#view-mode-selector').kendoDropDownList({
change: onMChange
});
in the method onMChange I am trying to show the progress bar with
kendo.ui.progress($("#grid), true);
and at the end of the method when all is done I have
kendo.ui.progress($("#grid), false);
But the data loads and I do not see the progress bar.
If I remove the last statement (the 'false' one) I can see the progress bar, but it never disappears.
If I debug, It appears and disappears when the data is ready.
It is not an issue of the data loading too fast, sometimes the data takes 5 seconds to be ready.
The data is already in the browser, I am just showing or hiding columns.
Kendo version v2016.2.714
Thanks
EDIT
on onMChange I have some ifs where I populate an array (columnsToShow) with the name of the columns I want to show (everything else will be hidden) then I call a function with this code:
showHideColumn: function(columnsToShow) {
var grid = $(this.gridId).data("kendoGrid");
var show = false;
for (var i = 0; i < grid.columns.length; i++) {
show = false;
if (columnsToShow.length > 0) {
for (var j = 0; j < columnsToShow.length; j++) {
if (columnsToShow[j] == grid.columns[i].field) {
grid.showColumn(i);
columnsToShow.splice(j, 1);
show = true;
break;
}
}
}
if (!show) {
grid.hideColumn(i);
}
}
}
That code seems to be very inefficient at hiding/showing columns, all activity stops for few seconds when I want to show all columns (after having hidden some), I have around 30 columns and 30 rows.
Your question is a little misleading. Is the #grid element you are having difficulty displaying the loading icon for a grid control (as per the name of the element) or a drop down control (as per the title of the question)?
If grid
In order to show the loading icon I used:
kendo.ui.progress($("#grid").data("kendoGrid").element, true);
And to hide:
kendo.ui.progress($("#grid").data("kendoGrid").element, false);
If drop down
I haven't had to force display loading icons for dropdowns however there is an example here, noting the comment specifying:
The element must have a position:relative style applied
Additionally further down, it is noted that the element cannot have child elements.
I have a 5 ViewModels. Every view has their own VM. When I start the program, the ViewModel changes the bindings, i.e.
private string _bruttolohn;
public string Bruttolohn
{
get { return _bruttolohn; }
set
{
if (value != null)
{
if (value != _bruttolohn)
{
_bruttolohn = value;
Calculate();
RaisePropertyChanged(() => Bruttolohn);
}
}
}
}
Bruttolohn = some value I put in to calculate and set the new values. I have ~100 other propertys, which are all using Binding. If I start the program, the calculation is fine and works fast! But when I change the View (All views are in a ContentControl. If I click on a button, the view is being changed like this: MyContent.Content = new FirstView();). Now here's the problem: If I change the view ~30 times, the ViewModel needs way too long to set the bindings. Why!?
+ If I debug and I'm at this point:
RaisePropertyChanged(() => Bruttolohn);
Error pops up: ObservableObject.cs is missing...?
There is nothing wrong with the code you've shown so I suspect the Calculation method. Profile it.
If the Calculation() method is too long to post, it shouldn't be in a property setter :)
I guess I found the solution. Every time I click on the button "FirstView", the Content of the ContentControl gets a NEW VIEW()! So every time I click on the button, it'll do:
MyContent.Content = new FirstView();
This means that there are still somehow Views in the background open... I can't explain it by myself, but if I set the View globally like
FirstView fw;
and say in the constructor of the MainViewModel
fw = new FirstView();
I can easily assign the content of my ContentControl like this (without creating a new View):
MyContent.Content = fw;
You can download a test app here: http://www65.zippyshare.com/v/89159114/file.html
It has a MainView and 2 Views. It shows my problem. If you click on the Button "FirstView", the content of the contentcontrol will be "FirstView.xaml". It has 2 textboxes, which calculate the sum and has a for-loop (for i = 0, i < 500, i++). If you calculate right at the start, the calculation takes only ~1 sec, but if you click the Button "FirstView" ~30 times and try to calculate again, the calculation takes more than 10 sec!!!
I thinks it's because of MyContent.Content = new FirstView(); You can check my program and correct me if I'm wrong or say if I'm right... Like I said, I think that this is the solution, but I'm not 100% sure.
if Calculate() isn't an async method, it blocks the UI.
You could use
Task.Run(() =>
{
Calculate();
RaisePropertyChanged(() => Bruttolohn);
});
Not relevant to your question, but maybe interesting:
if (value != _bruttolohn)
Strings should be compared using .Equals, as the same string can be referenced to different places in the heap.
So:
if (value == null || !value.Equals(_bruttolohn))