[Mapbender-commits] r5198 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Dec 16 06:14:03 EST 2009
Author: kmq
Date: 2009-12-16 06:14:03 -0500 (Wed, 16 Dec 2009)
New Revision: 5198
Modified:
trunk/mapbender/http/javascripts/mod_ResultList.js
Log:
allow adding selectboxes to resultList
Modified: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js 2009-12-16 10:42:29 UTC (rev 5197)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js 2009-12-16 11:14:03 UTC (rev 5198)
@@ -33,57 +33,55 @@
//alert($(this).data("modelindex"));
};
- this.addGlobalButton = function(buttondef){
- //buttondef format:
- //{"title":<if no image is given then this is displayed>, callback: <function( ))
- //type: <type> // either "select" or "button", defaults to "button"
- // if type is "select", add options like this:
- // selectoptions : [{label :<label>,value : <value>},... ]
- //
- // this is the domelement
-
- var bd = buttondef|| {};
- bd.title = bd.title || "no title";
- bd.type = bd.type || "button";
- bd.selectoptions = bd.selectoptions || []
- bd.callback = bd.callback || function(){};
- return;
-
+ this.addGlobalButton = function(buttondef){
+ //buttondef format:
+ //{"title":<if no image is given then this is displayed>, callback: <function( ))
+ //type: <type> // either "select" or "button", defaults to "button"
+ // if type is "select", add options like this:
+ // selectoptions : [{label :<label>,value : <value>},... ]
+ //
+ // this is the domelement
+
+ var bd = buttondef|| {};
+ bd.title = bd.title || "no title";
+ bd.type = bd.type || "button";
+ bd.classes = bd.classes || "";
+ bd.selectoptions = bd.selectoptions || []
+ bd.callback = bd.callback || function(){};
- var result = function(){
- var args = {
- WFSConf: me.WFSConf,
- geoJSON: me.model.toString(),
- selectedRows: me.getSelected(),
- table: me.datatable
+ var result = function(){
+ var args = {
+ WFSConf: me.WFSConf,
+ geoJSON: me.model.toString(),
+ selectedRows: me.getSelected(),
+ table: me.datatable
+ };
+ buttondef.callback.call(this,args);
};
- buttondef.callback.call(this,args);
- };
+
+ if($('#'+options.id+"buttonrow").length < 1){
+ $('#'+options.id).append('<div id="'+options.id +'buttonrow"></div>');
+ $('#'+options.id+'buttonrow').css("clear","both");
+ }
- if($('#'+options.id+"buttonrow").length < 1){
- $('#'+options.id).append('<div id="'+options.id +'buttonrow"></div>');
- $('#'+options.id+'buttonrow').css("clear","both");
- }
+ if (bd.type == "button")
+ {
+ var button = $('<span><button type="button" class="ui-state-default ui-corner-all '+ bd.classes +'">'+buttondef.title+'</button></span>').click(result);
+ $('#'+options.id +'buttonrow').append(button);
+ }else if (bd.type == "select"){
+ var select_options = "";
+ for (c in bd.selectoptions){
+ select_options += '<option value="'+ bd.selectoptions[c].value +'">'+bd.selectoptions[c].label +'</options>';
+ }
+ var selectbox = '<select class="'+ bd.classes + '">'+ select_options +'</select>';
+ $('#'+options.id +'buttonrow').append(selectbox);
+ }else{
+ alert("invalid buttondefintion");
+ }
+ };
- if (bd.type == "button")
- {
- var button = $("<span><button type='button' class='ui-state-default ui-corner-all'>"+buttondef.title+"</button></span>").click(result);
- $('#'+options.id +'buttonrow').append(button);
- }else if (bd.type == "select"){
- var options = "";
- for (c in bd.selectoptions){
- options += '<option value="'+ bd.selectoptions[c].value +'">'+bd.selectoptions[c].label +'</options>';
- }
- var selectbox = '<select>'+ options +'</select>';
- $('#'+options.id +'buttonrow').append(selectbox);
- }else{
- alert("invalid buttondefintion");
- }
- };
-
-
this.addRowButton = function(buttondef){
// buttondef format:
// title:
More information about the Mapbender_commits
mailing list