I am having a difficult time using the "select" method in the onInit
callback.

I am creating an array of items and then calling select as follows:
onInit: function(finderObj) {
    var itemsToSelect = ["href/item1", "href/item2"];
    $(this).finder("select", itemsToSelect);
}

When this code is run, I get the following error in the Firebug
console:
"uncaught exception: jQuery Finder: Target element does not exist"

I then added the same code that is on the finder demo for the "Select
Item" button, modified it a little to parse a comma separated list,
pasted "href/item1, href/item2" into the dialog and the correct items
were selected.

Any idea of what I am doing wrong?

Thanks,
Doug

On Apr 1, 11:18 am, Nicolas R <ruda...@googlemail.com> wrote:
> Tor,
>
> To select an item when the finder is created you can use the public
> method $('some').finder('select', URLS_ARRAY or URL_STRING or
> DOM_ELEMENTS ). Call this method on the onInit callback.
>
> There is no function that returns some sort of path for the current
> page. I believe it would be easy to hack one yourself, something like:
>
> var path = [];
> $('div.ui-finder').find('li.ui-finder-list-item-active > a').each
> (function(){
>      path.push( $(this).attr('href') );
>
> });
>
> path // = [ 'level1.html', 'level2.html', 'level3.html' ]
>
> So, you could store the array as a cookie (in string format of course)
> on window.onunload and then on load..
>
> $('some').finder({
> onInit: function(){  $(this).finder('select',path_as_array) }
>
> })
>
> I'm sure there are many ways to achieve this, but the two main things
> to keep in mind is that
> 1. you can pass an array of urls to .finder('select', ... ) and it
> will select them in that order; and
> 2. you can select the current path by using the path function I
> provided above
>
> Hope this makes sense
>
> On Apr 1, 1:06 pm, Tor <torgeir.ve...@gmail.com> wrote:
>
> > Am wondering if it would be possible to store the expanded state with
> > an anchor hash, to allow page reloads?
>
> > --
> > -Tor
>
>

Reply via email to