Re: automatic palette sorting
sorry for the late response. in the middle of huge Wicket rewrite of old JSP app. Below is the example usage we use. I doesn't sort onload since that is done in the backend. Tested this in IE 8/7/6. Wicket.Palette.sortOptions=function(box) { var data = new Array(); for(i = 0; i < box.options.length; i++) { data[i] = new Array(); data[i][0] = box.options[i].text; data[i][1] = box.options[i].value; } data.sort(function(a, b) { var aa = a[0].toLowerCase(); var bb = b[0].toLowerCase(); return ((aa < bb) ? -1 : ((aa > bb) ? 1 : 0)); }); for(i = 0; i < data.length; i++) { var op = new Option(data[i][0], data[i][1]); box.options[i] = null; box.options[i] = op; } } Wicket.Palette.remove=function(choicesId, selectionId, recorderId) { var choices=Wicket.Palette.$(choicesId); var selection=Wicket.Palette.$(selectionId); if (Wicket.Palette.moveHelper(selection, choices)) { var recorder=Wicket.Palette.$(recorderId); Wicket.Palette.updateRecorder(selection, recorder); $(choices).change(); } Wicket.Palette.sortOptions(choices); } Wicket.Palette.updateRecorder=function(selection, recorder) { recorder.value=""; Wicket.Palette.sortOptions(selection); for (var i=0;i -- View this message in context: http://old.nabble.com/automatic-palette-sorting-tp28096974p28238166.html Sent from the Wicket - User mailing list archive at Nabble.com.
Re: automatic palette sorting
Hi Robert, how did you call the new function. My IE always runs on error if I try to call the sort function ... Thanks, Peter robert.mcguinness wrote: > > in palette.js include the following function and call in > Wicket.Palette.updateRecorder and Wicket.Palette.remove > > -- View this message in context: http://old.nabble.com/automatic-palette-sorting-tp28096974p28177326.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: automatic palette sorting
not sure if this is the best solution but this is how we solved it (basically customized the Palette component to fit our needs). in palette.js include the following function and call in Wicket.Palette.updateRecorder and Wicket.Palette.remove Wicket.Palette.sortOptions=function(box) { var data = new Array(); for(i = 0; i < box.options.length; i++) { data[i] = new Array(); data[i][0] = box.options[i].text; data[i][1] = box.options[i].value; } data.sort(function(a, b) { var aa = a[0].toLowerCase(); var bb = b[0].toLowerCase(); return ((aa < bb) ? -1 : ((aa > bb) ? 1 : 0)); }); for(i = 0; i < data.length; i++) { var op = new Option(data[i][0], data[i][1]); box.options[i] = null; box.options[i] = op; } } -- View this message in context: http://old.nabble.com/automatic-palette-sorting-tp28096974p28097306.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
automatic palette sorting
Is there a way to automatically sort the available and selected items in a palette as they are changed? mail2web.com What can On Demand Business Solutions do for you? http://link.mail2web.com/Business/SharePoint - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org