I am using Telerik Combobox with EnableLoadONLoad = True i.e. Every time end user type a letter, server side event kicks in to pull records for that word. For example, In the dropdown box, if I type America then the system will search for A then AM then AME and so on... and brings results that matches those letters. So, in the case above, the system will ick server side event 7 times. Now the problem is search functionality takes a while (anywhere from 5 - 10 seconds to pull records.. beyond my control :( ) What I want is when end user type something , I want to wait for a second to see if user is still typing. After a second, I want the system to go for search. Hoping that within a second, end user will type whatever they need to. Now I can force the user to type minimum 5 letters and so on but end user can search with a single letter or multiple letters. They don't want to be restricted with no. of letters due to business requirements.
You can just specify an 'ItemRequestTimeout' in milliseconds of 1000 which will tell the combobox to wait 1 second before firing to the server.
The itemRequestTimeout on their comboboxes is 300 by default which is 3 tenths of a second. doing what Brian Suggested would work, but I have found that the default is usually enough time before it causes the postback.
Also if you incorporate MarkFirstMatch="true" for the ComboBoxes it will automatically go to the item that matches the text if it exists.
http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx
This should give you some other options as well.
But as far as forcing the user to enter 5 letters before the postback occurs, You would probably need to do onkeyup and onkeydown javascript events to check if they have entered 5 characters and then you could cause the postback.
Or you could use the OnClientkeyPressing property of the Telerik comboboxes to do the check.
function OnClientKeyPressing(comboBox, args)
{
if (comboBox.get_text().length > 4) {
//Do postback here
}
}
Something like that would do what you want I believe.
Related
I have a function updateRowValue, which updates a value in a row in a table based on user input. There are 11 columns whose values can be updated by the user, and the user can add/remove rows. I am currently testing on a table with 7 rows, and there is a severe lag between pressing a key on the keyboard and the change appearing on the screen.
Each time the user presses a key on their keyboard, the state is updated (I am using a controlled MUI TextField). I don't think the amount of inputs is the actual problem (though I might be wrong). I think the problem is that I have to traverse through the table_rows object every time a value should be updated.
My question is basically: Can I update the value each time the user presses a key on their keyboard and also make the app feel responsive to the key presses? If so, then how?
function updateRowValue(row_id, attribute, new_value){
const new_row = Object.assign(table_rows[row_id], {[attribute]: new_value});
const newState = Object.assign(table_rows, { [row_id]: {...table_rows[row_id], ...new_row} });
setTableRows({...table_rows, ...newState});
}
I found an alternative to the whole mess I had created. Instead of trying to optimize how I save the states (which might not even be possible) I realized that I don't actually need the states. I can access the form values directly.
By adding inputProps={{"data-row": row_id, "data-cell": cell_id}} to the TextField, and then using document.querySelectorAll("[data-row]"), it is easy and fast to access all cells and their data when it is actually relevant to use them (saving them to the database in my case).
Ordinarily, this is a very simple thing. My issue is I can't seem to get multiple values, so I'm guessing it's a format issue? In my report, here are the default values:
When I preview the report in VS, it shows up exactly as it should, and obviously, I have the multi-select setup correctly:
NOTE: The values of 2 and 3 are the ID's in the query. This is done to utilize the indexing on these values as opposed to just pulling up a big list of strings, so it's finding the ID but actually displaying the "description" in the drop-down.
After the report has been deployed, I discovered that within the options of the report (click report, go to Manage, then navigate to Parameters) this is where there seems to be the hang up. I can select just 2 or just 3 and there's no problem, it will use either of them as the default. I've tried various formats to use 2 AND 3 but have had no luck and get the error The value provided for the report parameter 'Model' is not valid for its type. (rsReportParameterTypeMismatch). I'm not sure why the default values selection in my first screenshot doesn't take care of this, but for whatever reason, the last screenshot appears to override this functionality. Any idea as to how I might get my 2 values?
I figured it out. Pressing enter to go to the next line, no comma or other separator will get this to work.
I'm trying out the slots feature in IBM Watson Conversations and have hit an issue which I'm not sure how to work around.
I have a use case that is collecting a number of pieces of information from a user so using the Slots feature makes sense. Unfortunately when I add a Slot with #sys-number the system will not accept 0 as a valid input. This slot is in fact required but 0 is a valid value.
Anyone have an idea of how to have a required Slot of type #sys-number that accepts 0 as a value?
The condition #sys-number is in fact a short hand syntax for condition entities['sys-number'].value. When 0 is sent the condition is evaluated to false as 0 is treated as a false by the expression language evaluator in Watson Conversation Service. Now this is not a desired behavior in this case. To prevent this for happening one can use entities['sys-number'] in the condition that will return true every time #sys-number entity is recognized in the input.
When using this in slot one might want to edit what gets stored in the context variable as changing the condition will also change what is stored in the variable. This can be done by a JSON editor - click configure slot gear next to the slot specification and in the window that opens click three dots, open JSON editor and there change what gets actually stored inside the context variable that gets updated by the slot.
Here is a link to system entity section in Watson Conversation Service documentation.
I had a similar problem with recognising zero values in slots and the system entity documentation did not explain it well enough (for me at least).
Further elaborating on Michal's answer above:
Click the "Edit Slot" option (gear icon)
Set the "Check For" attribute on a slot condition as entities['sys-number']
Click the edit slot modal menu options (three bubbles in corner)
Open the JSON editor
Change the context variable value to "<?entities['sys-number'].value ?>"
Result:
On ItemChanged event of datawindow, I have to prompt a message on wrong input.
The issue is: When I use messagebox(), It prompt message correctly but field is not being blank and by pressing TAB, the control is being shifted to next field. (means its accepting the wrong value by pressing TAB key again)
Here is simple code for above scenario:
if lb_error = true then
messagebox('Info','Only Digits Are Allowed ~nAll Digits Cannot Be 0')
this.object.payer_phone[1] =''
end if
Then I tried Modify property, Its working fine but Is there any possibility to change Its title and icon?? I am using following code and , Kindly help me.
if lb_error = true then
this.Modify("payer_phone.ValidationMsg='Only Digits Are Allowed ~nAll Digits Cannot Be 0'")
this.object.payer_phone[1] =''
return 1
end if
I am using PowerBuilder 12.0.
From the PowerBuilder help:
Return Values
Set the return code to affect the outcome of the event:
0 (Default) Accept the data value
1 Reject the data value and do not allow focus to change
2 Reject the data value but allow the focus to change
So in your case you need to RETURN 1 from the itemchanged event.
Since you are handling this error in itemchanged you need to 'bypass' the itemerror event. You do this by placing a RETURN 1 there.
By triggering the error in the itemchanged event you can create a custom error messagebox or use the system default and control the title, icon, buttons, etc.
Assuming payer_phone is the field being edited, I believe you need SetText() instead of setting the underlying value in the data set.
To understand this difference, you need to know that for data entry, there is a control "floating above" the DataWindow, moving from field to field with focus. When the entered data is accepted, the value in the floating control is flushed to the data set of the DW. GetText() and SetText() deal with that floating control. Your code is changing the DW data set. After the first error, the next time you press Tab, no change in the control has been detected, so the functionality that fires when data changes doesn't occur, and your error code never kicks off.
Good luck.
You can modify the icon and title by using the same function MessageBox with a different signature :
MessageBox ( title, text {, icon {, button {, default } } } )
HTH,
Ali
You can modify the icon and title by using the same function MessageBox with a different signature : MessageBox ( title, text , icon , button , default )
HTH, Ali
I've been wracking my brains on this simple macro for days and troweled almost every site and forum for an answer, to no avail. Thus, I come to the gurus of stackOverflow for my salvation:
I'm working in Access 2010 and have a database of events that are coming up. Right now the database opens to a form wherein any user may view the entered events and edit them if there's an error. Likewise, there's a report that pulls it's list from the form that everyone's working on.
What I'd like to do (for ease of use) is have a text field and a button. The field would be for date-input (i.e. 10/20/2015) and when pushed, the button would filter the list of events to show only things on or after the typed date. Likewise, I'm hoping to make another filter for the report that will display items only btw. certain dates (but I'm really just working on the first item).
The concept would look like this:
| [ Text Field | [BUTTON]
Event 1 ...................... Date.........
Event 2 ...................... Date.....
....
..
.
Note: This is a database for people who know NOTHING about Access, so I'm trying to spoon-feed the stuff they need to them.
I really appreciate the help, folks.