vaadin multiple date picker - vaadin

I'm really new to vaadin and am trying to create a date picker in which a user can select multiple days, with each selected date rendered in a highlight color, much like the date picker from doodle.
I started out using the InlineDateField, but am not getting anywhere.
Can it be done with standard vaadin components?
Licensed, non-free vaadin components are not an option, because this solution is for a non-commercial project with 0 budget.

And what about to take current implementation of datefield and make your own implementation? So you extend this class and change the JavaScript? You can inject your JavaScript with changed functionality... and handle the changes in your extended datafield class.

Related

What is the replacement for ListSelect in Vaadin 22?

I'm trying to update an application from Vaadin 7/8 to Vaadin 22.
ListSelect is gone, so I need a new widget field that satisfies these requirements:
Allows choosing multiple items
Suitable for use in FormLayout with value bound using Binder
Scrolls automatically when there are more than a handful of choices
None of the widgets in Vaadin 22 seem to qualify:
Select and ComboBox only choose one item
ListBox says ...designed to be used as a lightweight scrollable selection list rather than a form input field
Grid does not implement HasValue so can't be used with Binder
CheckBoxGroup doesn't look like it will scroll (requirement #3) (I haven't actually tried yet though)
What am I missing here?? What is the new equivalent of the old ListSelect?
If your Grid is set to multiselect mode, you can use grid.asMultiSelect() to return a MultiSelect object that does implement HasValue and can be used with Binder. Similarly, in single-select mode, grid.asSingleSelect() returns a bindable SingleSelect object.

How can I see details to grid in Vaadin flow?

In my Vaadin flow project, I have a grid and I set some items but it shows like grid data items
I want a decent format that a user can see specific details not like. Any idea or is there any component in vaadin to make this pretty?
There are two options to do that:
provide a better ValueProvider than the .toString(), that is used in your property right now. E.g.
grid.addColumn(person -> Integer.toString(person.getYearOfBirth()))
.setHeader("Year of birth");
TemplateRenderer: You can provide a "complex" HTML structure where to place content. The docs contain an example: https://github.com/vaadin/flow-and-components-documentation/blob/master/documentation/components/tutorial-flow-grid.asciidoc#using-template-renderers E.g.:
grid.addColumn(TemplateRenderer.<Person> of("<b>[[item.name]]</b>")
.withProperty("name", Person::getName)).setHeader("Name");

Delphi TComboBox Dropdown fields filtering [duplicate]

Everyone probably knows what I mean, but to clarify the control would need to:
Fire an event when user edits the text. The event would provide a SuggestionList: TStrings which you could fill with matches/suggestions.
if the SuggestionList is not empty a drop down should appear.
Unlike combo, the control should not attempt to automatically select/auto complete or otherwise affect the editing.
So, is there a Delphi edit/combo control that works like that ?
Use the autocompletion feature built in to all Windows edit controls.
First, fill your TStrings object however you want. Then use GetOleStrings to create a TStringsAdapter to wrap it. (The adapter does not claim ownership of the TStrings object, so you must make sure you don't destroy it while the adapter is still live.) The adapter gives you an IStrings interface, which you'll need because the autocompletion feature requires an IEnumString interface to provide the completion matches. Call _NewEnum for that.
Next, call CoCreateInstance to create an IAutoComplete object. Call its Init method to associate it with the window handle of your edit control. If you're using a combo box, then send it a cbem_GetEditControl message to find the underlying edit window.
You can stop at that point and autocompletion should work automatically. You can disable autocompletion if you want, or you can set any number of autocompletion options.
You say you don't want autocompletion, but in the OS terminology, I think what you really don't want is called auto append, where the remainder of the string is entered into the edit box automatically as the user types, but selected so that further typing will overwrite it, and the user needs to delete the excess text if the desired value is shorter than one of the matches.
There is also auto suggest, which displays a drop-down list of suggestions.
You can enable either or both options. You don't need to filter the list of suggestions yourself; the autocomplete object filters the IEnumString list by itself.
You can use standard TComboBox and faststrings library (for stringMatches() function).
procedure TForm1.cbChange(Sender: TObject);
var
s:Integer;
tmpstr:string;
begin
//suggestions: tstringlist
cb.AutoComplete:=false;
tmpstr:=cb.Text;
cb.Items.Clear;
for s:=0 to suggestions.Count - 1 do
if StringMatches(suggestions[s],cb.Text+'*') then
cb.Items.Add(suggestions[s]);
cb.DroppedDown:=(cb.Items.Count<>0) and (Length(cb.Text)<>0);
cb.Text:=tmpstr;
cb.SelStart:=Length(cb.Text)
end;
If you just want to show a file or url list:
SHAutoComplete(GetWindow(eb_MyComboBox->Handle, GW_CHILD), SHACF_AUTOSUGGEST_FORCE_ON | SHACF_FILESYS_DIRS);
I first implemented this feature like Rob described it in his answer. Later I saw that TComboBoxEx has the property AutoCompleteOptions where I set acoAutoSuggest to True and acoAutoAppend to False. The ComboBox now filters its item list when doing some entry and shows the matching items.
I'm using RAD Studio 10 Seattle and XE2 but don't know if this feature is available in older versions.
To the last bit of your question: "So, is there a Delphi edit/combo control that works like that ?":
A bit late to the party but yes, I have written a free and open source component that implements the Google Place Autocomplete and Google Place Details API's:
It does inherit from the standard TComboBox but you can modify the code to work with any TEdit
https://carbonsoft.co.za/components/
or
https://github.com/RynoCoetzee/TRCGPlaceAutoCompleteCombo

How to add custom columns to grid items designer in FireMonkey

I have created a custom column TComboColumn = class(FMX.Grid.TColumn) for TGrid. Currently I have to add this column to grids in the code, but I would like to be able to do this using the TGrid items designer, like I can when adding default column types (TColumn, TStringColumn, TCheckColumn etc).
Possibly Tools API doesn't provide support...
Possible decision: to write and register own component editor (from TComponentEditor).
The report of this problem on QC: http://qc.embarcadero.com/wc/qcmain.aspx?d=107177

Binding and Converting DateTime properties on all Models with ASP.NET MVC 3

I am just wondering if anyone has a method of binding DateTime properties of Models so that they are displayed in Views in the users selected timezone, but the Model uses them as UTC for storage in the database.
I am using ASP.NET MVC 3 with a SQL Server 2005 database but this will soon be upgraded to 2008 and will mean I can use the new datetime types if that helps with a solution.
I am using code from this post and this works well in binding date and time infomation posted from the View, and I assume with a little bit of extra code, I can easily convert the data to UTC.
So I guess I have 2 options that I need help with:
Custom Renderer
Is there a way of overriding the object that renders the data to the View so that a UTC date is converted to the users timezone when displaying the View, then the custom Binder I already have would convert it back for storage in the DB.
Is there a better way that I am not aware of?
This is a feature that is available on many sites (I already use it on the first version of this site I did in straight ASP.NET), but before I went and used the same methods again (I just had a static function I called when displaying the information and then a similar function call before saving), just wanted to know if someone had a better solution.
Thanks
Mark
You can use Html.EditorFor and Html.DisplayFor with customized template for DateTime. You will still need custom binder tho.

Resources