I currently have a v-autocomplete component but once the user clicks the search it expands and shows all available items. I want the list of items to only display once there is input. There are too many available items and don't want the user seeing all of them right off the bat. Also if there is a way to limit it to only showing the top 5 that match the user input.
<v-autocomplete class="vtext"
v-model="selectedTopic"
:items="getTopics"
item-text="Name"
item-value="Id"
:outlined="false"
:rounded="true"
:solo="true"
:single-line="true"
append-icon='fa fa-search'
#change="topicSelected()"
:hide-no-data="true"
:allow-overflow="false"
no-data-text="No topic found"
return-object
>
</v-autocomplete>
The reason it shows all items on initialization (when clicking empty), is because you are setting the items right away with getTopics what you need to do in that function is check
<v-autocomplete class="vtext"
...
#input="handleInput"
if (inputModel){ //get the topics}
else { return []}
In terms of only getting the first 5 results, again you do it in the same function:
if (inputModel){
// do search
return results.slice(0,5)}
Related
" Select list item: Attempt to get item number 0, of the list [5]. The minimum valid item number is 1.
Note: You will not see another error reported for 5 seconds. "
Hey Guys,
The message on top appear when the app open the app not crashing but I need to click somewhere on screen few times till it disappear..
The idea is to search a value of var 'UID' in firebase.database and when it found it I need to get the value of is brother key..
I want you please to help me to clear this message I tried a few ways to get the result but nothing yet..
Thanks a lot for helpers :)
When Screen Open.
This is how I tried to get the uid && employeeKey.
for your help me I set var 'UID' = to uid value of employee number 1
'UID' get the value from firebase.auth form on screen 1..
The index in list block returns 0, if the "thing" has not been found in the list and in this case you are trying to get the value from the 0th item from the empKey list, which does not make sense.
Therefore you will have to add an if statement... if the returned index is 0, then do not search for the empKey.
Btw. the better place to ask questions like this would be the MIT App Inventor community...
I'm trying to add the option to my users that, on a List Validator, to allow select any of the options or a blank option. Spreadjs has the IgnoreBlanks setting, which I use, so when the user uses the delete key or the backspace and deletes the cell it validates correctly.
However, I would love to use the same functionality as in Excel, which allows blank options in the list validator, in part of the list.
I've tried to target the <select> element that holds the list and programmatically add the empty element, however, it crashes after the user selects the empty option.
I've also tried to add different escaped characters to the list. If I select a character that represents an empty string or a tab, it won't add a new option to the list. If I use any strange character, or even the null character \0 you get a new option to select, but the content is that typical rectangle you see when your font doesn't have the character you're trying to display.
I've also tested using a regular ListValidator like in the example pages, not our custom functionality and doesn't work either.
https://www.grapecity.com/demos/spread/JS/TutorialSample/#/demos/basicDataValidator
I have also tried creating a FormulaListValidator, and if my range has empty cells I could then get an empty option on my list, however, because the range may have duplicates, I get duplicated options.
After researching a little bit I found a workaround in a different language which I adapted to Typescript (Angular 6)
export const getListValidatorFromArray = (spread: GC.Spread.Sheets.Workbook, data: any[]) => {
// saving validation list values in a hidden sheet
spread.addSheet(spread.getSheetCount());
const sheet = spread.getSheet(spread.getSheetCount() - 1);
sheet.visible(false);
for (let i = 0; i < data.length; i++) {
sheet.setValue(i, 0, data[i]);
}
// create validator based on the values
const dv = GC.Spread.Sheets.DataValidation.createFormulaListValidator(
'=' + sheet.name() + '!$A$1:' + sheet.name() + '!$A$' + data.length
);
return dv;
};
Note: This creates an extra sheet for each validator you create. Makes sure you reuse them as much as possible (i.e. assigning it to a variable when it's created, and reusing the variable for other columns/rows that use the same one).
I have used the below to extract a string from a paragraph.
data = '''actions/steps to (re-) produce the problem:
1) Media--> Music collectio--> on right side--> click on Add Favourite icon--> on clicking Add from Favourite icon--> (Delete from favourite ) will display--> again click on Delete the favourite
expected result/behaviour:
it should display the track as well
observed result/behavior:
1st track list will display then
2nd list of songs will display
3rd no records will display
this behaviour will appear again and again
possible impact:
this can be an issue while driving
actions/steps to recover from error:
software version tested (including supplied software or CAF version if relevant):
MGU :- 17w.25.4-2'''
observed=[]
for i in data["Error Description"]:
if len(re.findall(r'(Observed result\/behavior:|observed result\/behavior:)([^(]*)Possible impact:', i))==1:
observed.append((re.findall(r'(Observed result\/behavior:|observed result\/behavior:)([^(]*)Possible impact:', i))[0][1])
else:
observed.append(" ".join((re.findall(r'(Observed result\/behavior:|observed result\/behavior:)([^(]*)Possible impact:', i))))
OUTPUT :
It shows nothing as the "observed:" has 4 lines. If it generally has one line and the immediate preceding is "possible impact:" then it displays the output.
I need my output though if the observed has n no of lines
Please help.
This should work on the assumption that observed result/behavior: will have one blank line before the next paragraph:
begin = data.index('observed result/behavior:')
end = data[begin:].index('\n\n')
output = data[begin:(begin+end)]
print(output)
observed result/behavior:
1st track list will display then
2nd list of songs will display
3rd no records will display
this behaviour will appear again and again
I currently have a list<float> that are arranged in an increasing order. My sliders min.value is the lowest value of my list (i.e. first element of my list) and sliders max.value is equal to the last item of my list.
What I want to do is that whenever my slider is at a specific value or +-0.1 to one of the elements on my list, I Want to be able to get the index out that specific element to perform a task.
Any suggestions?
Someone asked for code, I don't even like this code since it only gives me the right value once I press "play" from zero, but then it removes my data, so I can't go back with the slider
this code is inside update void, and isPlaying is true when I press a "play" button
if(isPlaying){
timeSlider.value += Time.deltaTime;
timer = timeSlider.value;
print(timeSlider.value);
if((newTimes[0]>=(timer-0.1f)) && (newTimes[0]<=(timer+0.1f))){
print("time: " + newTimes[0]+ " at run time: " + timer);
NewTimes.RemoveAt(0);
}
}
You can set the slider to use whole numbers in the inspector and use the value as your index?
My first thought would be:
Set Slider Steps to Floats in your List
-> Perform task on List[currentSliderStep] as needed
I have created a shell extension for windows with COM, however I seem to fail to properly match the ids of items I add in the overload of IContextMenu::QueryContextMenu with what I receive in the overload of IContextMenu::InvokeCommand. In my code I use InsertMenu and InsertMenuItem (as far as I understood they do the same, but the latter has some more features?). However I'm not sure which arguments passed to InsertMenu/InsertMenuItem correspond to what I must be looking for in LPCMINVOKECOMMANDINFO::lpVerb. I need some way to easily know that when I add items x, y, z to a context menu, I can then know exactly which one of x, y or z has been clicked.
EDIT: It seems that the verb equals the number from top to bottom of the item in the current menu/submenu. However I have two sub-menus each with x amount of items, so they have the same IDs of 1,2,3. How do I set custom IDs or something?
Firstly you should define an enum that holds the command IDs for your menu items, e.g.
enum {
CMDID_FIRST = 0,
CMDID_DOSOMETHING = CMDID_FIRST,
CMDID_DOSOMETHINGELSE,
CMDID_LAST,
};
These ID values need to start from 0.
In your IContextMenu::QueryContextMenu implementation:
when you add your menu items you need to give each of them an ID by setting the MIIM_ID flag in the MENUITEMINFO.fMask field, and setting the MENUITEMINFO.wID value.
give each of your menu items an ID derived from its command ID as defined above, plus the value of idCmdFirst which is passed into QueryContextMenu. E.g. the "Do Something" menu item would have MENUITEMINFO.wID set to idCmdFirst + CMDID_DOSOMETHING, and "Do Something Else" would have MENUITEMINFO.wID set to idCmdFirst + CMDID_DOSOMETHINGELSE.
the return value from QueryContextMenu needs to be MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, x) where x is the ID of the highest-numbered item you added plus 1 (alternatively, if all items were sequentially numbered, the total number of items). Basically, you're telling the host which menu item ID values are now in use so that no other context menu extensions add items that clash with yours. In the above example, you'd return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, CMDID_LAST).
In IContextMenu::InvokeCommand:
test if lpVerb (or lpVerbW) is an integer value using the IS_INTRESOURCE macro.
if so, the command ID can be found in the low word. E.g, if the user selected "Do Something Else", you would find that LOWORD(lpVerb) == CMDID_DOSOMETHINGELSE.