Sencha Tree panel how to placed elements horizontally? - extjs

I am writing an app where I have to show some structure like family tree. Is it possible to set all children in horizontal position in this example: http://try.sencha.com/extjs/4.1.1/docs/Ext.tree.Panel.1/viewer.html
Something likle:
Root
|
child1 ---- child2
|
|
child1.1

You can use Bread Crumbs to make this tree panel work. You are going to need to use Ext JS5 to use bread crumbs.
Here's a working example: https://fiddle.sencha.com/#fiddle/bja

Related

Angular carousel for 3 or more div tags

Need to create a carousel for 3 divs containing different information, the carousel should show the current active element and should also show the beginning of the next slide,please suggest a solution to do this is the proper way.
Thanks in advance.
You can try hexagon which somewhat like your expectation.
rn-carousel-transition : hexagon;
See the demo
http://blog.revolunet.com/angular-carousel/
https://github.com/revolunet/angular-carousel

angular-foundation and angular-translate: apply translation into attribute back-text

I'm using angular-translation and angular-foundation modules with AngularJS and have defined Foundation top-bar like this:
<top-bar custom-back-text="true" back-text="My back text">
[...]
</top-bar>
I need to apply translate filter to My back text. Already tried these two solutions but with no success:
example 1 - CODE
<top-bar custom-back-text="true" back-text="'BACK.KEY' | translate">
example 1 - TEXT IN MENU
BACK.KEY
example 2 - CODE
<top-bar custom-back-text="true" back-text="{{ 'BACK.KEY' | translate }}">
example 2 - TEXT IN MENU
'BACK.KEY' | translate
Do I something wrong or is there no possibility to achieve this with these two modules?
Used versions
angular-translate: 2.4.2
angular-foundation: 0.5.1
If you check the js source code of foundation you will find this piece of code that handles back button
if (settings.custom_back_text == true) {
$('h5>a', $titleLi).html(settings.back_text);
} else {
$('h5>a', $titleLi).html('« ' + $link.html());
}
$dropdown.prepend($titleLi);
So it creates new element and adds to dropdown, result of which is that it copies the value you specified in the back_text. By that time "translate" is not resolved so it copies whatever you put there.
A quick hack to do to solve it you could listen for language change by doing
$rootScope.$on("$translateChangeSuccess", function...
As you can see in the piece of code from foundation.js it creates "a" element inside "h5", so you can do something like this
$rootScope.$on("$translateChangeSuccess", function(){
angular.element(".dropdown h5>a").html($filter('translate')('BACK'))
})
where "BACK" is the key used for translation.
But keep in mind that it's not a good practice to manipulate DOM inside controller, so you may create directive for that.
Though there may be better way to achieve it, this could be just quick hack to do the thing.

Highlight all active items in nested menu (AngularJS, ui-router)

I'm using AngularJS with ui-router for my website.
I have a multi-level menu (when you select one item, you can see next menu's level)
home | about | contact us
NY | LA | SF
Street1 | Street2 | Street3
So, at this example we looking at Street3 details, in LA in Contact us page. All selected items is active.
I can't make it with ui-router's ui-sref-active="active" because it's highlight only last item (Street3) Other items are not active, but should be.
Are there any ideas to fix it?
Thanks
You can always use $state.includes(stateName) to check if the current active state is equal to or is the child of the state stateName. Combine it with ng-class, you will get to highlight the correct tabs.
Here is a working example.

How to get all values from a form?

I am definitely sure doing something wrong which I didn't resolve. I have a form component which are includes several textfield, radio button as well as windows. If I used the following code :
console.log(Discounts.getForm().getValues());
// Discount is form name which is defined like below
var Discounts = Ext.create('Ext.form.Panel', {
...
}
I can see all values except grid panel which is included window component ( to tell the truth I can't see all other window values!).
The component tree like below :
+-- FORM PANEL ( layout card )
|
+-- CARD LAYOUT - 1
| |
| +- COMBOBOX
| +- TEXTFIELD
|
+-- CARD LAYOUT - 2
| |
| +- WINDOW
| |
| +- GRID PANEL
|
+-- CARD LAYOUT - 3
| |
| +- RADIO GROUP
Do you have any idea what I am doing wrong?
For instance, I would like to get winArticle window field values as well as Discount forms together.
PS : The code is very large so that I putted JSFiddle.
Source
You have a formpanel in a formpanel, by giving the child formpanel an itemId and using component queries like Discounts.down('#yourchildformpanelitemid').getValues() you could probably get its values...
However, since your code in no way maintainable, my advice, refactor/restructure your code and use MVC structure. From Sencha:
Large client side applications have always been hard to write, hard to
organize and hard to maintain. They tend to quickly grow out of
control as you add more functionality and developers to a project. Ext
JS 4 comes with a new application architecture that not only organizes
your code but reduces the amount you have to write.
You will need to restructure your code and define your components separately. this will make your app maintainable. In your case the formpanel you create would be a separate component and have its own controller, thus enabling you to use the same formpanel elsewhere.
Also, read the following article from Sencha, ExtJS practices to avoid:
http://www.sencha.com/blog/top-10-ext-js-development-practices-to-avoid/
Most of these tips (if not all) are applicable to your code.
For example, you are nesting components like crazy. Most of the nesting is unnecessary. For example:
...
items: [
{
xtype: 'form',
items: new Ext.Panel({
items: [
{
xtype: 'fieldset',
...
xtype: 'form' creates a form panel, why on earth create a panel inside?
More on ExtJS MVC Architecture:
http://docs.sencha.com/extjs/4.2.0/#!/guide/application_architecture

Layouts in angular

I am trying to develop a simple directive which can take a option of layout configuration.
Lets say i want to render something like this on the page
I want to render this 4 co-ordinates in one directive, which can then render directive1, in 1 and directive 2 in 2, directive 3 in 3 and directive 4 in 4
1 | 3
|
------------|----------------
| 4
2 |
|
Any ideas?
Note, i can statically render, the page without any issues, question is how do we render this dynamically, like..how an example directive would look like?
Thank you.

Resources