Sigma Php Ajax framework, Ajax Components, GUI Builder
May 17, 2012, 12:26:10 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Dynamic option?  (Read 261 times)
caldewallace
Jr. Member
**
Posts: 6


View Profile
« on: November 15, 2011, 08:25:37 AM »

Hello!

I need help to this sentence. I need that the choices were dynamic:

 var colsOption = [
        {id: 'id' , header: "Login" , width :200, editor:{type:'text'}, hidden:true},
        {id: 'agente' , header: "agent" , width :150, editor:{type:'text'} },
       
       {id: 'shop' , header: "shop" , width :150 , editor : { type :'select' ,options : {'Nike': 'Nike', 'Adidas': 'Adidas'}}  },
       
The options should leave extract to database. I revised tha post http://sigmawidgets.com/forum/ajax-data-grid-view/change-dropdown-list-dynamically/ but i can`t used.

Any solution? Sorry, i speak a little english :s
Logged
JLG
Jr. Member
**
Posts: 6


View Profile
« Reply #1 on: November 17, 2011, 05:43:29 PM »

Here's a bit of code using the beforeLoad function defined within grid options.

I use it to re-populate a column's drop down list via Ajax use XHConn (http://xkr.us/code/javascript/XHConn/) before the load of new data. The URL it calls returns a comma-separated list of values. The below may help in providing a means of achieving what you seek to achieve.

   beforeLoad : function () {

      var myConn = new XHConn();

      if (! myConn) alert("XMLHTTP not available. The browser you are using will not allow me to refresh the list of team leaders.");

      var fnWhenDone = function (oXML) {

         var responseText = oXML.responseText;

         var reportsToCol = project_team_members_grid.getColumn("reportsTo");

         var leaders = responseText.split(",");

         reportsToCol.editor.valueDom.options.length = leaders.length;

         for (var i=0; i < leaders.length; i++) {

            reportsToCol.editor.valueDom.options.text = leaders;

            reportsToCol.editor.valueDom.options.value = leaders;

         }

      };

      myConn.connect("ajax/project_drop_down_list_value_request.php", "POST", "requested_list=current_team_leaders", fnWhenDone);

   },
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!