i'm very new to sencha.i have a bit problem in accessing the data from framework..
what i planned is to access the attribute "selectedIndex" from the class Ext.Picker.Slot
so that i can place it the index.js file and loop the "selectedIndex" attribute so that i can create a rotating effect to my list , i'm trying to dynamically change the value of "selectedIndex" so that my list seems to be rotating so please do help me........
Thankyou,
........
Ext.Picker is not an extjs class. You should provide more info so I can help you. In any way there must be a method which puts selectedIndex to desired value. Js don't have properties like in other OOP languages. It's just a variable. Changing value of it don't do any "action". So, there must be method which do the "action" and sets selectedIndex.
Related
Hi I have an array of models(images) which is the model property of an ArrayController.
I want to be able to sort the the array such that when click on the image it automatically moves itself to a predefined index. (E.g. when I click an item on the array it should move to middle of the array) and the UI is updated to reflect the new position.
Here is an example of what I am trying to achieve:
http://emberjs.jsbin.com/vesakafaca/1/edit?html,js,output
Also since ArrayController is/will be depreciated from v1.13 is there alternative way of doing this without using ArrayController ?
Here's an updated emberjsbin of what I think you're looking for -
http://emberjs.jsbin.com/qujihihivi/edit?html,js,output
ArrayController vs. ObjectController doesn't matter anymore, you can just use Ember.Controller.extend as you'll see in the updated bin.
I did the sorting in the model by creating an Ember Array for the model and tagging the .sortBy("index") onto it.
I also updated the templates with new syntax, you don't need {{bind-attr}} anymore and you should use {{#each itemCollection as |item|}} instead of just {{#each itemCollection}}, makes for easier to read templates and provides consistent scope.
Hope the updated bin is helpful!
I have seen this bunch of code in a tutorial:
var searchTerm = this.$('#searchTerm').val().trim();
I would like to understand the utility of the this. in front of the selector, it's the first time i see that.
In a Backbone.View, this.$ gives a scoped version of jQuery. It is in fact equivalent to using this.$el.find which is in turn equivalent to using $(this.el).find.
Anyhow, the reason it is a good idea to use it is that it will only access html elements from within the view's element/rendered template. Thus, you don't have to worry about the rest of the html page and you will always select the element you expect to.
Imagine that you have a view that spawns sub-views and that each of these have an editable field. If you don't use the scoped version of jQuery to get the right editable field, you will have to give a unique id to each of these html elements to make sure you will select the right one when retrieving it's content. On the other hand, if you use the scoped version, you will just have to give this editable field a class attribute and selecting this class will give you a unique element, the right one.
This is the same query as this.$el.find('#searchTerm').val().trim();
You haven't given any context to that code, but assuming it's a method inside a View, this refers to the View object.
this.$ is a shortcut to access jQuery from the View object, and is equivalent to the method this.$el.find.
I have a fragment with a table.
the value of this table comes from a list in the bean.
I need to fill the list when the fragment is loaded.
I was trying to do that as I saw here:
https://kr.forums.oracle.com/forums/thread.jspa?threadID=2386966
but I see that it's filling the list on load and then the constructor of the bean is called again,
so the list get a new instance and in fact its empty again.
Do you know why it happens?
Or is there any other way to fill a list in the bean when the fragment is loaded?
Thanks!
You need to change the scope of your bean.
I suggest trying the 'view scope' first.
You can have the default entry point to your taskflow be a method call that initialize a list in a pageflowscope managed bean. Then you should be able to refer to that list in all the pages in your flow.
I am new to Cakephp and indeed OOP, so forgive me if i haven't fully grasped the MVC concept yet. I have search a lot but cannot find an answer - perhaps my way of working below is not correct. I hope you can help.
I am building a site which will have many elements relating to their tables and data. I intend to use a view to pick and choose the relevant elements and any parameters needed.
For example, the homepage of my site will have two elements - a latestusers element and a latestscores element. I am trying to use a view not related to either the users or scores models/controllers, stored in 'other/index.ctp'.
I have tried using set() to pass a variable from the users controller (latestusers action) into the other/index.ctp view, but the viewVars remain empty. Could this be due to scope of the variable (i think it is fine for a view in the users folder, i.e. a view specific to the users controller).
I could achieve what i want to do by using global variables, but i think this is missing the point of MVC/OOP. Would be grateful for any suggestions.
I can include code if need be - it is fairly basic at this stage - but i feel my problem lies with how i am going about things, not the code itself.
Cheers,
James
Yes, the issue is with the scope. If you're going to use variables in the element you'll need to pass them in from your view. So the flow would look something like this
Controller $this->set()s the variable into your current view/layout
Your view/layout calls $this->element with the current element path.
Your element uses those variables.
In number 2 you need to pass your variables as an array of data. This section on the cookbook gives more information : http://book.cakephp.org/view/1081/Elements
<?php echo$this->element('helpbox',
array("helptext" => "Oh, this text is very helpful."));?>
Note - I didn't understand part of the question. Just want to make sure you are passing data to the correct view. You should not be calling the view of another controller in your active controller.
Your other/index.ctp should be an element and that element should be called from your layout.
I am trying to load/show completely different set of values in a combobox(this one resides as a editor within an EditorGridPanel) based on the valueField of another combobox(this one resides outside the grid in top bar). I have already seen a tutorial(http://www.extjs.com/learn/Tutorial%3ALinked%5FCombos%5FTutorial%5Ffor%5FExt%5F2) wherein ALL the values for the secondary object are stored locally and then filtered however, I have already created a link which will supply me with json data based on the valuefield, so I would like to use this url to keep the code efficient.
I have also tried to refresh the datastore but its simply not being reflected on the combobox.
Please advise
Thanks
Found the solution, loading values from a url is straightforward.. if you want to manipulate the query(like I wanted), you would have to strip url off the dynamic parameters and assign them to baseParams of the store and then call store.load()
It worked for me!!