ExtJs - Triggering Column Header Sorting programmatically (e.g. with QTP) - sorting

Our team is setting up test scripts for automating interaction testing using QTP, for an ExtJS based application.
Many of our elements/objects are being detected as desired, with the exception of column header sorting triggers.
Our grid panel has remote sorting, however programatically triggering a column header "click" doesn't fire our sorting, although "click"ing manually on the column header does. I've tried mousedown and mouseup, on the column header Div, and it's children -titleEl and -textEl as well.
Any ideas?
Thanks in advance.

The simplest way would be to tell QTP to generate mouse events, this way all the events that are fired when a real human clicks the header will be fired when QTP clicks it.
As seen here
origReplayType = Setting.WebPackage("ReplayType")
Setting.WebPackage("ReplayType") = 2
Browser("B").Page("P").WebElement("column header").Click ' your script line here
Setting.WebPackage("ReplayType") = origReplayType
If this is a common occurrence you can use RegisterUserFunc to define a new DeviceClick function to your test objects.
A slightly more complex way is to debug the application and see which event triggers sorting the column and then use FireEvent with the correct event.

Related

Filter every character in Kendo Grid

How do you force a Kendo grid to filter data after every character is typed, as in after every letter, not just when I press enter button?
I noticed that Kendo sends requests after every character typed, but without page size, and this request is used for autocomplete. I want to change that to bind this data not to autocomplete, but to the main grid instead.
I am using built in filters, one for each column.
Sorry for later response, I didn't have much time. Anyway as I mentioned in comment, this functionallity is not supported by Telerik. So you have to create everything by yourself.
In following example I have used filterMenuInit event which is fired after you click on filter icon (and only once!). In that event I have modified filter elements to add custom classes and ids. Then in jQuery I am catching keyUp events and adding items into filter.
Here is small example. I have implemented only equals filter, so you will have to do some modifications. But I hope it can help you in next work.

Get value from autocomplete text field in ApEx

I want to create a dynamic action, that will set a value to an item on the page, when the value of another item (autocomplete text field) is set.
So the proccess goes like this:
Click on the autocomplete field
type some letters
choose one of the suggested values
I cannot find an event that will be executed when the selection of one of the suggested values happens. This way, I cannot see how I can read the value of the autocomplete field, once a suggested value is selected.
The change event doesn't fit my needs, it doesn't execute when one suggested value is selected.
I had the same problem, found this link: https://community.oracle.com/thread/2130716?tstart=0 and modified my dynamic action as follows to get the desired behaviour:
Event = Custom
Custom Event = result
From the link:
the problem seems to be the default behavior of the browser. When you
enter some text into the autocomplete and the list is displayed, the
focus is still in the text field. Also if you use the keyboard cursors
to pick an entry the focus will still be in the textfield. That's why
the change event of the textfield doesn't fire. It only fires if you
leave the field.
On the other side if you pick an entry with the mouse, the browser
will remove the focus from the text field for a moment (before the
JavaScript code puts the focus back), because you clicked outside of
the field. But that's enough so that the browser fires the change
event.
I had a look into documentation of the underlaying jQuery Autocomplete
widget
(http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/) and
there is actually an event called "result" which can be captures if an
entry is selected from the drop down list.
Try "Lose Focus" as event. It will trigger your dynamic action when you leave the autocomplete field, i.e. your curosr is moved to another field.
This probably depends on the APEX version you are using.
In case of 18.2, because the underlying component is based on Oracle JET's "inputSearch" component, you need to use following configure to capture the select change event for text with autocomplete:
event: Custom
custom event: ojupdate
Reference:
https://docs.oracle.com/cd/E87657_01/jet/reference-jet/oj.ojInputSearch.html#event:optionChange
I turned on the browser console, then turned ApEx Developer toolbar debug, and found that, on the contrary, the "Change" event does fire upon user clicking with the mouse on one of the selections. However if the user uses keyboard (type a few letters to narrow the list down, then use down arrow key to arrive at desired value, then press enter) then the Change event does not fire, just as you say.
Moreover: even when you do get the value sent back via mouse-click initiated Change event, the value isn't the autocomplete's complete and valid value, but instead the possibly partial and wrong-case value just as typed by the user. I.e., the the change event's submission of the value precedes the autocomplete's substitution.
The answer that #VincentDeelen gave is the best alternative that I can see, although it doesn't quite give that "instantantenous synchronicity" feel. You could maybe use the "Key Down" event, but be careful with that. You could get a really excessive amount of web and db traffic as each and every keystroke (including corrections) results in another firing of the dynamic action.
Testing environment: ApEx 4.2.3 with Chrome 33 as well as IE 9.
p.s. This might be worth a mention to the ApEx development team as well.
It's not really ideal, but you could use onfocus(). I'm looking for the same thing you are, I think, a custom event that fires when the selection of a suggested value happens. I haven't found it yet though and that is my work-around for now. It will run whatever function you've created for this initially with no value, but once the selection is made it will return focus and run the function again with the right value. Like I said, not ideal but it works.
Jeffrey Kemp is right. You can set it up through a dynamic action using the custom event, result. You can also register it on page load using document.getElementById("{id}").addEventListener("result", {function}); or $("#{id}").result( function( event, data, formatted ) { //something here });.
Oracle apex 19 now added a "component event" when you create a dynamic action called "Update [Text Field with autocomplete]" - this action is fired when you select a value from the list, but not when you leave the field (similar to adding the custom event "ojupdate").

jquery ui binding to sortable recieve event when dealing with nested sortables

I have a need to sort columns and separately I need to be able to sort fields accross columns and would like to hook into the col sort finished so that I can save the new column position and then also hook into the field sort finished event so that I can save the new field position
There is a jsFiddle showing an example here (doesn't seem to work in IE, but thats a different story!). What this shows is that when a column is dragged no alert is shown and when a field is dragged between columns the field AND column alerts are shown.
I'm using 'receive' to avoid multiple calls, one for the source and one for the target.
Any help would be really appreciated. Thanks
You should use different events to hook into, sortupdate does what you want. Because you are nesting sortables it is also important to prevent event bubbling, this is what causes your double alert. Here's an updated fiddle
By the way, when dragging a field to another column the sortupdate handler is called twice because two columns changed.

Calling a child dialog and passing in input parameters

I've read a bunch of articles on how to call dialogs from javascript and integrate them into a ribbon button, but I am running into a problem where I need to do all that AND pass in a string as an input parameter (to a child dialog?).
Is this possible? Would I have to modify the calling url of the dialog?
I've read this one about calling dialogs with the SelectedControlAllItemsId, which is almost what I need.
Ideally I would open the form of the parent entity, click on one of the subgrids in the left hand navigation, then select some of the related/associated entities, click the ribbon button and wait for the dialog or workflow to chew through all of those Ids.
Is it possible to capture these selected items using SelectedControlAllItemsId, then pass that string to a child dialog so it can then call another workflow? Or should I capture that string, store it in the calling record via REST and then let a workflow run on a field-trigger?
The end result is that I must run a custom workflow and manipulate the parent record + the selected related records. I have already written the workflow, but I do not know how to trigger it the way I want.
Perhaps there is something I am overlooking? Is there a way to call a custom bit of code directly from javascript and let it work the rest of the way?
I'm not sure how an interactive dialog should deal with a collection of records. Surely that would require sequential iterations of the dialog, as the user processes each record? As you will see from the SDK (and discussed in your linked thread), it is only possible to run a dialog against a single record.
A workflow is a different matter.
- Custom ribbon button, using SelectedControlAllItemsId
- Supporting JScript handler should iterate SelectedControlAllItemsId
- Each iteration should issue an ExecuteWorkflowRequest using the current item id and based on code such as this (which issues an ExecuteWorkflowRequest from JScript
Remember that the workflow request is asynchronous so you can just send all the requests one after another rather than waiting for the outcome of each request.

AjaxFormValidatingBehavior Performance and Lost focus on Firefox

My project is using Wicket's AjaxFormValidatingBehavior to auto-save form content to Session on sort of a multi-tab form with a tree menu (there is no save button on individual tabs, though there is a "Save" button that actually submits the form, runs the validations and saves contents to database). I am facing few issues:
Since the behavior is added to all form components' onChange event, there is a server-trip every time user moves from one field to another. I know that a throttle duration can be specified to prevent this, but its not possible to set in my case as my forms are of different lengths/complexity, many components dynamically generated (including the tree menu). But is there a more elegant solution to auto-save form content (that doesn't have a submit button) rather than this annoying solution.
Another issue I am facing is that post onChange event, on Firefox the component loses its focus after the "server trip" ends. While on IE7 it works fine.
For the first question I think you need to add a pipelining facility, on your components' onchange call a javascript function of your which calls your webapp. You can include a feature similar to the one provided with the throttle duration but page-wide (delay each calls and only trigger the last if it is older than x milliseconds for example).
For the second one, I think you have to use the AjaxRequestTarget#focusComponent in your behaviors, or handle this thing in your "wrapper" as described in the first answer.

Resources