Does declaring root:{ nodeType: 'async'} serve the purpose of AsyncTreeNode in Ext 3 ?
If yes, how can I test it?
If no, what can be done to achieve that?
nodeType doesn't do anything anymore so you can remove that. By
defining a store with a proxy all nodes become asynchronous unless you
set children to an empty array in which case it won't make a request
when you expand the node.
For more info: http://www.sencha.com/forum/showthread.php?128137-Where-is-AsyncTreeNode
Related
I recently generated a Sumo scenario using OSMWebWizard.py. Then, using NetEdit, I added the edges to osm.net.xml and saved the extra 6 routes in a file calling it extra.rou.xml with its demands.
I would like to know how to append extra.rou.xml to my current scenario, so the SUMO will understand these 6 routes are also part of the scenario when running the run.bat file?
You need to open the osm.sumocfg and add your extra.rou.xml to the list of route files. It will probably look like this then:
...
<input>
<net-file value="osm.net.xml"/>
<route-files value="osm.passenger.trips.xml,extra.rou.xml"/>
<additional-files value="osm.poly.xml"/>
</input>
...
In Rails 4 feature spec, using RSpec 3 and Capybara, how do I assert if a certain number of specific tags are present in a page?
I tried:
expect(find('section.documents .document').count).to eq(2)
But it doesn't work, saying:
Ambiguous match, found 2 elements matching css "section.documents .document"
Also, is it a good idea/bad practice to test in a feature spec something so specific as the kind of tags and classes used in the view?
The problem with using find is that it is meant to return a single matching element. To find all matching elements, which can then be counted, you need to use all:
expect(all('section.documents .document').count).to eq(2)
However, this approach does not make use of Capybara's waiting/query methods. This means that if the elements are loaded asynchronously, the assertion may randomly fail. For example, all checks how many elements are present, the elements finish loading and then the assertion will fail because it compares 0 to 2. Instead, it would be better to make use of the :count option, which waits until the specified number of elements are present.
expect(all('section.documents .document', count: 2).count).to eq(2)
There is some redundancy in this code and the assertion message will be a bit strange (since there will be an exception rather than a test failure), so it would be better to also switch to using have_selector:
expect(page).to have_selector('section.documents .document', count: 2)
I am using the fantastic extension by Yiiext "nested-set-behavior":
https://github.com/yiiext/nested-set-behavior
I am interested to know if anyone can let me know how to move (up or down) a root node when I am running the nested set with multiple roots.
tree example:
Phones (root node)
1.1 Mobile
1.2 Fixed
Cars (root node)
2.1 Fast
2.2 Slow
2.3 Average
Planes (root node)
3.1 Large
3.2 Small
At the moment when I pull out the full tree and show this to the user I get the above result.
I would like to be able to move "Cars" before "Phones".
Is there any way of doing this?
I have tried:
$cars = Category::model()->findByPk($cars_id);
$phones = $cars->prev()->find();
$cars->moveBefore($phones);
This gives me an error in the moveAfter method of the nested set behavior class.
Any one done this before?
Thanks
Dave
As the doc suggest the the prev() method returns :
Array of Active Record objects corresponding to ....
Therefore you have to approach this with different way e.g
$phones = Category::model()->findByPk($phones_id);
$cars = Category::model()->findByPk($cars_id);
$cars->moveBefore($phones);
Or other approach which suits your application scenario
Your code could be fixed by :
$cars = Category::model()->findByPk($cars_id);
$phones = $cars->prev()->find();
foreach($phones as $phone){
$cars->moveBefore($phone);
}
which does not make sense ;)
(p.s: did not test this code)
As I understand, you have 3 nodes, which are the roots.
The problem is that the methods moveAfter() and moveBefore() can not be applied to the main roots. You are trying to move a node, relatively another node, but they are in different trees.
If cars and phones have a common root, it will be success.
In other words, you operate with nodes in different trees, which know nothing about each other.
my problem is the following. I'm currently making a blog-page with get-page, get-resources, form-it, and wayfinder. This question requires a decent amount of knowledge about Modx and snippits. I've got the page numberin and all working and i've got a template page with all my calls in it (called weblogTemplate). This template has the following wayfinder call in it :
[[!getResources? &parents=`5` &limit=`5` &tpl=`blogPost`]]
[[!getPage?
&elementClass=`modSnippet`
&element=`getResources`
&parents=`4`
&depth=`2`
&limit=`5`
&pageNavOuterTpl=`[[+first]][[+prev]][[+pages]][[+next]][[+last]]`
&pageVarKey=`page`
&pageFirstTpl=`<li class="controlFirst"><a[[+classes]][[+title]] href="[[+href]]">Eerste pagina</a></li>`
&pageLastTpl=`<li class="controlLast"><a[[+classes]][[+title]] href="[[+href]]">Laatste pagina</a></li>`
&pagePrevTpl=`<li class="controlPrev"><a[[+classes]][[+title]] href="[[+href]]"><<</a></li>`
&pageNextTpl=`<li class="controlNext"><a[[+classes]][[+title]] href="[[+href]]">>></a></li>`
&includeTVs=`1`
&includeContent=`1`
&tpl=`blogListPost`
]]
as you can see the parent is set here to id number 5. This is fine for the homepage but any child page connected in the blog page also uses the same template and so would also have the same menu as the parent. You could use a fix to simply create 1 template for a page and keep using a different getResource call but keep in mind that it is a blog im making, new pages keep getting added. The user can't (, and wouldn't even understand to) make a template and edit any code. A solution i thought of would be to make the parent id dynamic, so it adjust to whatever page it is currently on. So for example if it was on the page with id number 12 it would make the parent call set to 12 and so show all the content under id number 12. If anyone has any ideas / thoughts / solutions i would be very grateful to hear them.
(a link about wayfinder that i used.)
The best solution would be to use two templates - one for main and one for the blog pages and use in blog templates:
&parents=`[[*id]]`
The problem with the user solveds by setting default_template in the system settings.
This worked for me:
[[!getPage?
&elementClass=`modSnippet`
&element=`getResources`
&parents=`[[*id]]`
&depth=`0`
&limit=`10`
&pageNavOuterTpl=`[[+first]][[+prev]][[+pages]][[+next]][[+last]]`
&pageVarKey=`page`
&pageFirstTpl=`<li class="controlFirst"><a[[+classes]][[+title]] href="[[+href]]">Eerste pagina</a></li>`
&pageLastTpl=`<li class="controlLast"><a[[+classes]][[+title]] href="[[+href]]">Laatste pagina</a></li>`
&pagePrevTpl=`<li class="controlPrev"><a[[+classes]][[+title]] href="[[+href]]"><<</a></li>`
&pageNextTpl=`<li class="controlNext"><a[[+classes]][[+title]] href="[[+href]]">>></a></li>`
&includeTVs=`1`
&includeContent=`1`
&tpl=`blogListPost`
]]
Thanks to Vasis for the provided help.
I've written a Drupal 7 module that creates a custom node type. I've added a number_integer field to the node, to act as a counter. How do I set the counter field to default to zero, when a node gets created?
Next, while processing the node, I need to increase the value of the counter by one and save the new value. Do I do that by altering the $node object and then calling node_save? Or is there a better way, using the Field API or something?
I still would not really dare to save back a node just like that. I would still use
$form_state = array('values' => array());
drupal_form_submit('story_node_form', $form_state, $node);
much like we did in Drupal 6 (just with slightly different syntax).