What ComponentQuery should I use for this example in this.control()? - model-view-controller

I have:
1.) What should I type in this.control() for getting the reference to the grid panel?
My plan is, when user double clicks one row, new tab is created. I already have code for creating new tabs but I just need to get reference to the grid panel.
Something like this:
'viewport > westpanel > accordion > gridpanel': {
doubleclick: function...
}
2.) Let's say that I gave an ID to the grid panel. How can I get reference in this.control using .get method?
3.) How can I be sure that I've got the right reference? Can I console.log() - it or something like that?
I would know how to do this without MVC but here I need help. :)
Thank you! :)

It is quite easy once you understand how to use it. First you should read the API about the ComponentQuery cause that is what is used within the control.
this depends on your components. You so can go by the xtype 'panel > grid': {itemdblclick:this.yourCallback}
the recommend way if you can't define a really unique path by xtypes '#myID': {itemdblclick:this.yourCallback} using defined refs within the control is not possible in the currently release, as far as I know.
Use Id's instead of just xtypes '#myID > grid': {itemdblclick:this.yourCallback} or define additional params '#myID > grid[customProp=identString]': {itemdblclick:this.yourCallback}

Related

CarouselView.FormsPlugin get index of specific page

I'm using Carousel View by alexrainman for creating custom wizard.
I need to get index of specific page by its type (I don't know exactly which index would that page have).
Something like this:
var indexAdvanced = MyCarouselView.GetIndex<ContentView>(typeof(AdditionalDefectParametersContentView));
but of course, this code doesn't work. While creating this question, I've got an idea with using CarouselView's ItemsSource. How to do it properly? TIA.
By the way, I've already found an answer. >_<
The resulting code is:
// My CarouselView consists of ContentViews
_indexAdvanced = MyCarouselView.ItemsSource.Cast<ContentView>().
IndexOf(view => view is AdditionalDefectParametersContentView);
So it works!
Don't know what should I do: delete this question or leave? Maybe It would be useful for somebody, so I'll leave it for now.

Handsontable Dynamically Set Settings

I have a very big handsontable. I have dropdown columns defined, but, the values for the sources are retrieved with AJAX.
How can I set the "source" property of a "column" of type "dropdown" dynamically?
Regards!
You can, and should, use:
hotInstance.updateSettings({
columns: getNewColumns()
})
Where getNewColumns() would return an array of columns with the data and new source (or make the AJAX call from in here). That should do it!
Thank you for the answer ZekeDroid.
I was able to solve my issue.
First lets talk about a problem in the angular directive:
I am using the handsontable's angular directive. Two things happen: 1. If I associated the datarows attribute to a nested variale in the model, for example $scope.hot.data, then when I change the value of the model ( $scope.hot.data ) the grid ui is not refreshed. I am pretty sure this is an issue with the directive. Now: 2. Assume I use $scope.data and I update its value (this is the model right), then the grid ui is not refreshed either. I have to do something like hotInstance.updateSettings({data: newData}) as well.
I have to do both things; that is, update the model and call the update settings method. This is the only way I could get it work properly.
Note: if I do $scope.$apply() instead the updateSettings, I get an error in the console.

Robotium : Getting number of items in spinner?

I'm a QA, and I'm new to android automation as such, and I am having problem in automating the spinner / Dropdown related activities in my app. I am using Robotium 4.1 for my automation.
The Spinner in my app is implemented using actionbarsherlock. The Hierarchyviewer shows it as Popupwindow:SOME-RANDOM-ID. It looks like the implementation is internal to actionbarsherlock. After talking to the dev he tells me that it's a "non-visible" element. I don't understand what that means, because I can see the element.
Also, I can't find the methods mentioned in some of the other questions here.
I suppose the right way is to use solo.getViews(), and solo.getCurrentViews etc. but I don't know how to use the parameters in there, so whatever I tried didn't work.
Can someone guide me with a detailed example? (including how to give the parameters to getViews etc will be much appreciated.)
How to get number of items:
mSpinner.getAdapter().getCount();
How to click on specified item on spinner:
solo.pressSpinnerItem(indexOfSpinner, indexOfItem);
How to get current spinners:
ArrayList<Spinner> currentSpinners = solo.getCurrentViews(Spinner.class);
How to get spinner with specified index:
Spinner spinner = getView(Spinner.class, index);

AJAX Page Loader navigation bar

My site is:
http://econrespuestas.com.ar
And i'm having trouble with AJAX page loader integration. When you click on a link in "secondary-menu", it adds it the "current-menu-item" class, but it doesn't remove de "current-menu-item" class from the other ones.
I'm trying to do it with this code:
// highlight the current menu item
jQuery('secondary-menu li').each(function() {
jQuery('thiss').removeClass('current-menu-item');
});
jQuery(thiss).parents('li').addClass('current-menu-item');
but it isn't working. There must be something wrong with the removeClass selector. Could you help me?
Firstly, thiss doesn't exist (unless declared somewhere else). It must be this. In addition try something more like...
jQuery('.current-menu-item').removeClass('current-menu-item');
jQuery(this).parents('li').addClass('current-menu-item');
This is saying "Remove the class current-menu-item from any objects with the class current-menu-item, then add the class current-menu-item to the parent li of the clicked item"
In addition, make sure that in your CSS, .current-menu-item{...} appears after any styling for the non-currently selected item.
See Fiddle: http://jsfiddle.net/6hR9K/2/
Also, unless you have a specific conflict with using the $ sign in place of jQuery, I suggest doing exactly that.
$('.current-menu-item').removeClass('current-menu-item');
$(this).parents('li').addClass('current-menu-item');

Is there a way to select a child element inside another child element in Watin

I am trying to select a link/button inside of a form, that is in a div. the way it was made is that there are two links/buttons of the same id, name etc. however they are in different forms, so the code i wanted to use is:
_myTest.Form(Find.ById("PermissionsForm")).Child(Find.ByClass("saveBtn")).Child(Find.ByText("SAVE"));
any help would be appreciated
I think this is what you need:
var button = _myTest.Form("PermissionsForm").Button(Find.ByClass("saveBtn"));
This will lookup the button having the class 'saveBtn' inside the form 'permissionsform' in your browser instance _myTest.
Have a look at this page to decide if you need to have .Button(..) or .Link(...) based on the html tag that is used in your html.
How about building a regex for the element?
Regex could something like this
Regex elementRe = new Regex("id=LnkOk href="http://stackoverflow.com");
Then you can use your code to Click this link. The Click method can be extended to accept Regex if it is not already doing that.
Let me know how this goes or if you need more info.
Cheers,
DM

Resources