This is a migrated thread and some comments may be shown as answers.
Setting an image Url for a listitem
2 Answers 38 Views
This is a migrated thread and some comments may be shown as answers.
Oded
Top achievements
Rank 1
Oded asked on 25 Oct 2009, 02:24 PM
Hello,

I have a two listboxes that I use to transfer items from one to another. On my destination listbox I want to set one item as a default item.
I have decided to add a button that will take the selected item and set an image to it to indicate that this item is the default one.

I have done so using javascript:

function setDefaultReport() {  
                selectedReportsList.trackChanges();  
                var selectedItem = selectedReportsList.get_selectedItem();  
                if (selectedItem) {  
                    if (defaultReport) {  
                        defaultReport.set_imageUrl("");  
                        }  
                    }  
                    selectedItem.set_imageUrl("/images/icon.gif");  
                    defaultReport = selectedItem;  
                }  
                selectedReportsList.commitChanges();  
            } 

When I push the button to run this function I get an invalid argument error during runtime of the script. It happens in the insertBefore function of the current list item.

Any ideas?

Thanks,
Oded

2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 05 Nov 2009, 11:57 PM
Have you tried doing this server-side as in this demo? Since you're clicking on a button already that could be viable option.
0
Oded
Top achievements
Rank 1
answered on 08 Nov 2009, 07:58 AM
Server side solution is not relevant in this situation. Any way, I have decided to use checkboxes instead.

Thank you.
Asked by
Oded
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Oded
Top achievements
Rank 1
Share this question
or