views:

82

answers:

0

I am working with the Dashcode List element from the library and am trying to make a selection from within the program.

I have 2 lists binded to a datasource that gets requeried, which removes my selection from the lists. I am trying to keep the selection on the lists, so my current attempt to workaround the problem is to save the index of the selection on the list before it is refreshed so I can reselect it after the updating my datasource. I have looked in the List.js for the appropriate methods but they aren't working for me.

To grab the index (I am not allowing multiple selections) I have

        var indexB = document.getElementById("list2").object.selectionIndexes();
        var indexA = document.getElementById("list1").object.selectionIndexes();

Then I perform a query on a datasource that is binded to both lists.

        var dataSource = dashcode.getDataSource("model");
        dataSource.performQuery();

This causes me to lose the list selections so I am trying to reselect with

        document.getElementById("list1").object.setSelectionIndexes(indexA,false);
        document.getElementById("list2").object.setSelectionIndexes(indexB,false);

I believe the script executes past all the code but does not make the selections.

If there are any other alternate methods of keeping the selection on a dynamically binded list please let me know.