How to set selected value when using g:select in grails - html

I'm newbie with Grails framwork.
I have issue:
I have Domain is: "Country". And I wants to show list country in select tag by using g:select in Grails
For example: The data store in database can see below
ID Name
1 England
2 Canada
3 Germany
Now, I wants set "Canada" is selected.
Who can help me. Please!

Use the value attribute to set the selected item:
<g:select name="user.company.id"
from="${Company.list()}"
value="${user?.company.id}"
optionKey="id" />

Why not use g:countrySelect tag? This will save One whole Domain.

Use the select tag structure provided by mpccolorado, then to have Canada selected by default change the value to:
value="2"
(the Id for Canada).

Related

How can I change the input received by clicking in a datalist?

I have a datalist that shows the autocompletion of some fields how can I make sure that the input is only a part of that selected field??
You can solve this problem by defining a variable of type number.
After selecting from the input, add a number to the variable and using ngIf in html or if in ts, Control the number of choices.
I assume that you have Street Names in the dropdown and that object also includes street information as well (maybe in some other variable). So you want user to search using the street information as well but in the dropdown you just want to show the user Street names? if that's the case,
you can do something like this:
<datalist>
<option>
{{streetName}} <span style="display:none">{{streetInfo}}</span>
</option>
</datalist>
This way your street information wont be shown but will filter the result on basis of stretInfo as well.
hope it helps.

How to select multiple categories(more than 20-30 unique values) in dropdown with ease?

I am running an application where users can select categories for a selected field:
example: user-selected field = 'country' then the user can select 'country names'(India, China, America etc.) in the dropdown.
This works well when categories have unique values less than 15(this may vary). But when users need to select more than 15 categories it becomes very difficult for the user. I wanted to know what are the best possible solutions to ease this process?
example: user-selected field 'city' now users want to select 200 city names from the dropdown.
It can be a box where user can paste comma sepearated category values and we can auto fill these in dropdowns, or a simple file upload.
Please let me know your thoughts.
maybe not make a dropdown but a input field and validate it via options list (like in dropdown but type-to-select) small example:
<input list="id"></input>
<datalist id="id">
<option value="USA"></option>
<option value="GERMANY"></option>
<option value="RUSSIA"></option>
<option value="CHINA"></option>
<option value="FRANCE"></option>
<option value="INDIA"></option>
<option value="UK"></option>
</datalist>
hope this helps =] if you dont know how it works - copy it to any html file to tag and just use on custom page to understand =]
I think the best solution will be to give the user a text box, where the user can paste comma-separated values and we can extract and auto-select the defined values.

AngularJS Multiple Select in Query

My issue is that I have an Angular Search app going, (The one from the Lynda.com course) and when I attempt to add multiple selection boxes they are not cumulative. Meaning that when i have, for instance Cervical in the first box selected, and then attempt to choose Muscle in the second one, it un-populates Cervical. What is it that I need to be doing?
<select ng-model="query">
<option value="Cervical">Cervical</option>
<option value="Thoracic">Thoracic</option>
</select>
<select ng-model="query">
<option value="Muscle">Muscle</option>
<option value="Bone">Bone</option>
<option value="Neural">Neural</option>
<option value="Tendon/Ligament">Tendon/Ligament</option>
</select>
If I also need to add in my code for the .js let me know, but that all seems to be running well. Also, this is utilizing a .json file
-T
Thank you for the above answer. Now my follow-up is that when i change them to query-1 and query-2. I then need to adjust the list's ng-show
<ul class="artistlist" ng-show="query">
<li ng-animate="'animate'" class="artist cf" ng-repeat="item in anatomy | filter: query | orderBy: anatomyOrder:direction">
<a href="#/details/{{anatomy.indexOf(item)}}">
<img ng-src="images/{{item.shortname}}_tn.jpg" alt="Photo of {{item.name}}">
<div class="info">
<h2>{{item.name}}</h2>
<h3>{{item.type}}</h3>
</div>
</a>
</li>
</ul>
However, if I just add a 2nd ng-show="query-2", then what occurs is that the functionality is lost, and the two items i currently have in the JSON file will show up if I have either Thoracic or Cervical selected when they should only show during Cervical.
If I add a completely second UL with its own unique query-2, then by choosing Cervical & Muscle I have two seperate lists appearing instead of a slimming down of the one list that I want.
Thanks for the help
-T
You are using same model for both fields , so one changes, the other also changes but since that value is not in its options so it will show no value
assign different model values like ng-model="query1" and ng-model="query-2"
I created a fiddle for you. Kindly update this and let me know if you want more
https://jsbin.com/buhexo/edit?html,js,output
You have both select boxes bound to the same model. Angular two way data binding is updating both at the same time. However, since you do not have the same options in both lists the first select will "unselect".
Provide a unique name for each model.
You share the model, and since there is 2 way binding when you update the model (i.e. query) all of its references will update as well (i.e. all the select boxes). You need to come up with a scheme where you don't share the model and you keep the first value.
So change to ng-model="query1" and ng-model="query2", then in your controller you will decide how to handle the search parameters.

How to change "DestinationName" property of UNION ALL Transformation in SSIS

I want to make friendly names of Union All inputs; however, the Destination Name is dimmed.
I have 10+ inputs and it is really annoying finding the destination "Union All Input 10"
The best solution I could find so far is add Path Annotation as displayed in the picture below:
I want to rename Union All Input 1 to somthing meaningful.
Looks like Microsoft has stated that they Won't Fix This. Bummer. Everyone please upvote the Microsoft Connect link and maybe they will assign a developer.
Edit it in the XML Code, like so:
<input refId="{}" hasSideEffects="true" name="YOUR NEW NAME HERE">

Import Google contact with custom Field from csv

I have a csv as
First, mobile, id
Tom, 1276546789, 52
rosh, 2764898735, 73
.......
.......
.......
I would like to import this contact details in my google account with including the custom field name "ID" and its value.
I found so many option from google search but none of them works. it only insert the name and mobile only.
Thanks in advance.
The heading "Organizational ID Number" is valid, it is added as a custom field towards the bottom of the contact page.
I believe "Government ID Number" is also valid but haven't used it myself.