Hey,
uccio83 wrote:
>
> I'm trying to modify the Finder demo to insert a "SearchAsyouType"
> textfield to search through the full model.
> I don't want to live-filter the List contents, but I would like a live
> popup holding a list of all the node containing the string in the
> textfield. The user would click on a row of the popup and finally the
> correct node (at arbitrary level) would be selected in the lists.
> I thought it would be necessary to linearize the model in a list of
> "fullpath-element".
>
I don't think that this is necessary. You can search in the data on a
recursive base which should be much faster than doing the linearization
every time (depending on your search algorithm).
uccio83 wrote:
>
> So I tried to navigate the model from json.Store.getModel(). <br>
> Example of linearization: <br>
> User/All/Adobe<br>
> User/All/Parallels<br>
> User/mw/Documents<br>
> ...<br>
> <br>
> I tried:<br>
> <code>var files = model.getFiles();<br>
> console.log (model.getName(), files);</code><br>
> <br>
> Firebug prints an array containing 5 undefined values: <br>
> <code>root [undefined, undefined, ... ]</code><br>
> The actual elements are contained in a private array property called
> <code>__array__ </code>
The data is contained in a qooxdoo data array [1] which adds change events
to the native array. Accessing the data can be done with getItem and
setItem. Thats something firebug cant know. He only sees that it has a
length property and tries to show the content which he cant access with
array[1] e.g. Thats why firebug is printing out something unusable.
uccio83 wrote:
>
> <code>var files = model.getFiles().__array__;<br>
> console.log (model.getName(), files);</code><br>
> <br>
> Now the correct (I guess) elements are printed: <br>
> <code>root [qx.data.model.files"name[6371] { $$hash="6371", more...}, ...
> ]</code><br>
> <br>
> Is there something wrong about the Json store implementation?<br>
> Am I using a wrong approach?
Accessing object properties with __ at the beginning is a bad idea in
qooxdoo because these are by convention private properties which will be
renamed on build to secure that privates are not used. So be careful with
these kinds of properties.
But except of the accessing of the privates, the approach should be fine.
Regards,
Martin
[1] http://demo.qooxdoo.org/current/apiviewer/#qx.data.Array
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/Linearize-a-JsonStore-model-tp5174671p5176543.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel