Creating ExtJS tree dynamically - extjs

I want to create a simple tree with two parent nodes using ExtJS. The root node will be invisible. The tree should look like:
+Invisible
|
|_A
|_B
+Visible
|
|_C
|_D
My query from the database is returning result in the following format
Description | IsVisible
A 0
B 0
C 1
D 1
I have seen examples online, for example(http://www.clintharris.net/2011/how-to-use-extjs-4-treepanels-with-both-static-data-and-model-stores/) but they all show creating tree dynamically with only one parent node whereas I need to create it for two parent nodes. Can anyone suggest how to do that?

It all depends on the structure of the response that you are getting from the server.It will be easy to answer if u post ur server response ...

Related

Parsing XML file in cprogram for particular element

currently im working in parsing xml by c and c++
im using pugixml library in c++ and libxml2 library in c for parsing xml
assume i have root element in xml as "configuration" and it have 4 child elements which are protocolversion,servername,daqlist and device.
Now i can get root element (configuration),by using this root i want to move its particular child (device) without moving one by one.
In C++ by using pugixml,we have following line to directly move from configuration to its child device,
doc.child("Configuration").child("device").
In c by using libxml i just move one by one child as,
if cur node is root (configuration),then im using,
cur= cur->children->next->next->next->next->next->next->next->next->next(for move to device from config)
i dont want to move by next next..
i want simple function to move from current to particular node in c by libxml..
could anyone please help to solve this issue..?
The ->next->next... approach assumes a fixed layout of nodes and is unreliable. I'd suggest that you:
iterate the children until you find one with
child->type == XML_ELEMENT_NODE and
strcmp((char *)child->name, "device") == 0
or xmlStrcmp(child->name, BAD_CAST "device") == 0
use XPath to find nodes matching /configuration/device

maya makePaintable attribute

stupid question but I m having an issue with that.
Can you make more than 1 attribute paintable on the same shape ?
I am adding 3 double array attributes for testing purpose and I make them paintable trough a loop while adding them.
When I do that, I can t paint them through my test and to verify that i tried painting it via right click on the mesh -> paint -> mesh and I only see the usual paintable attributes + the first one I defined...
Is there anything specific to do to declare more than 1 attributes paintable ?
Thanks !
I found out why it wasn't working. The documentation for makePaintable is wrong ...
cmds.makePaintable('node','attribute') like shown in the documentation doesn't work. Instead, you have to do cmds.makePaintable('nodeType','attribute') and your mesh has to be selected (I suppose as you don't specify it in the command)
It is now working.

Titan edge properties in Gremlin

quick question regarding querying a graph database in Titan using a Cassandra back end.
Splitting the problem down into it's simplest form, say I have a relationship that goes something like this:
node1 ----------> node2
When loading in data, I have assigned a number of properties to each edge using the e.setProperty("name",value) command. Say I have three properties called property1, property2 and property3. What I'd like to do is return the value of a certain property, say property1. My code looks like this:
g.E(1).getProperty("property1")
However it returns null. Does anyone know the correct way of adding edge properties and querying them appropriately?
getProperty() is only for a single object (vertex or edge). What you have, is a pipe. You can use either:
g.E().property("property1")
or:
g.E().property1
or:
g.E().next().getProperty("property1")

ExtJS Find Node within Tree Branch

I'm trying to check whether a certain node exists beneath a branch of an ExtJS tree. Knowing the ID of the parent node, is there a library function to check whether a node exists beneath the parent (by its ID)?
I've checked the API numerous times over, and can only seem to accomplish this by iterating through the entire branch of the tree.
Is there a library function which allows me to check if a child exists (by its ID) if the parent node ID is known?
Thanks!
PS, to find the parent ID, I'm using the following:
tree.getNodeById('myID');
Ext.tree.TreeNode "contains" function does exactly what you want:
var parent = tree.getNodeById('myID');
parent.contains(tree.getNodeById('childId'));
Have you looked at DomQuery? The API defines the method jsSelect: selects a group of elements.
jsSelect( String selector, [Node/String root] ) : Array
Parameters:
selector : String
The selector/xpath query (can be a comma separated list of selectors)
root : Node/String
(optional) The start of the query (defaults to document).
Returns an Array of DOM elements which match the selector. If there are no matches, and empty Array is returned.

Displaying a dynamic data structure in Silverlight DataGrid

I have a data structure like this:
MyDataStructure{
string Name{get;set}
string Title{get;set;}
IDictionary<string, bool> Values{get;set;}
}
I want to display items from an array of this structure in a data grid type of display
Name | Title | {Values[0].Name} | {Values[1].Name} | ... | {Values[N].Name}
Any suggestions?
I think that you could find something from question (here) I was having the same issue few days ago. Briefly I have found only two solutions:
using reflection to "transform" your Dictionary to a runtime generated class with the properties taken from the Dictionary itself (the properties name will be taken, for examle from key value)
using a Dynamic Language (such IronPython) to do the same thing described before but in a simplier way (I haven't tested it yet)
I don't know right now if this will be fixed in SL3. Right now seems to not be possible to bind using "position".
If you find any other solution is well accepted :)
Giorgio

Resources