Alpha DevCon 2018
Results 1 to 2 of 2

Thread: Formview dropdow editor question

  1. #1
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,031

    Default Formview dropdow editor question

    How do i populate dynamically at runtime the content of a dropdown coming from an sql table? On the videos it shows only how using static data like MA, NY etc.

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,807

    Default Re: Formview dropdow editor question

    Several ways to do this. Ajax callback to grab some data, called by the a FormView function. Or... take a page out of the Moble Northwind app... and set up a Client-side Data Cache. If the data isn't too much then this is perfect. Excellent for stuff like State dropdowns. onRenderComplete might look like this...

    Code:
    var _onFail = function() { 
    
    };
    
    var _filter = '';
    var _order = '';
    
    var _onStatesSuccess = function(data) {
    	var lookup = data.map(function(obj) {
    		return Object.keys(obj).sort().map(function(key) { 
    			return obj[key];
    		});
    	});
       {dialog.object}.__ddStates = lookup;
    }
    
    {dialog.object}.getFromDataCache('tblStates',_onStatesSuccess,_onFail,_filter,_order);
    tblStates is the Client-side Data Cache made up of a StateCode and StateName.

    Then in your Editor, Set value in editor...

    Code:
    {dialog.object}.setValue('EDITOR_3_TXTBOX',value);
    {dialog.object}.populateDropdownBox('EDITOR_3_TXTBOX',{dialog.object}.__ddStates,true);
    No other code needed in the FormView control.

Similar Threads

  1. code editor screen size question
    By martinwcole in forum Alpha Five Version 10 - Desktop Applications
    Replies: 3
    Last Post: 07-15-2010, 07:41 AM
  2. Filter dropdow
    By JimDK in forum Alpha Five Version 9 - Desktop Applications
    Replies: 1
    Last Post: 09-18-2009, 02:39 AM
  3. Question about import() & the code editor
    By Steve Schwartz in forum Application Server Version 9 - Web/Browser Applications
    Replies: 6
    Last Post: 06-16-2009, 10:16 AM
  4. Dumb Question About Code editor
    By Graham Wickens in forum Alpha Five Version 7
    Replies: 2
    Last Post: 03-21-2007, 08:48 AM
  5. Question about memo editor
    By drgarytraub in forum Alpha Five Version 5
    Replies: 2
    Last Post: 09-18-2002, 06:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •