Code Tidy - Pastebin

New     Fork     Embed     View raw     Report
BENN987 EXTCODE 2 - actionscript

Embed

You can embed this paste into a blog or website with this code:

<iframe class="codetidy" type="text/html" width="100%" src="http://codetidy.com/paste/embed/183" frameborder="0"></iframe>

Add comment

Captcha
  1. /* GREG'S CODE TO RENDER GRAPHS & SEARCH - TEMPORARY */?
  2. function drawChartView()?
  3. {?
  4.  ?
  5.         //Loop through each chart view?
  6.         for(var i = 0; i < chartViews.length; i++)?
  7.         {?
  8.  ?
  9.                 (function(){?
  10.                         var chartView =  chartViews[i];?
  11.  ?
  12.                         //Create a container DIV element for the chart?
  13.                         Ext.getCmp("personsChart").update("<div id=\""+chartView.name+"\"></div>");?
  14.                         //$("plotcanvas").append("<div id=\""+chartView.name+"\"></div>"); // OLD CODE?
  15.  ?
  16.                         //Fetch the chart's data?
  17.                         chartView.update(function(){?
  18.                                 //After the update is complete, execute this code?
  19.  ?
  20.                                 //Define a chart click handler to set the filters of the grid view?
  21.                                 function onBarClick()?
  22.                                 {?
  23.                                         var filterVals = chartView.getChartDataFilterValues(this.index)[0];?
  24.                                         var filters = chartView.getFieldFilters();?
  25.                                         for(var j = 0; j < filters.length; j++)?
  26.                                         {?
  27.                                                 setFilter(filters[j].filter.field,filterVals[j+1],chartView);?
  28.                                         }?
  29.                                         applyFilters();?
  30.  ?
  31.                                 }?
  32.  ?
  33.                                 //Draw the chart, passing the ID of the DIV created above as the "canvas" property, and the click handler?
  34.                                 chartView.drawChart({canvas: chartView.name, onBarClick: onBarClick});?
  35.  ?
  36.                         });?
  37.                 })();?
  38.         }?
  39.  ?
  40.  ?
  41. }?
  42.  ?
  43.  ?
  44. /************************************/?
  45. /*** OTHER CODE IN BETWEEN HERE *****/?
  46. /************************************/?
  47.  ?
  48.  ?
  49.  ?
  50.  ?
  51.  ?
  52. /* VARS FOR PERSONS MODULE */?
  53. var store = "";?
  54. var colModel = "";?
  55. var chartViews = "";?
  56. /* END VARS FOR PERSONS MODULE */?
  57. MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {?
  58.     id:'grid-win',?
  59.     init : function(){?
  60.         this.launcher = {?
  61.             text: 'Persons Module',?
  62.             iconCls:'icon-grid',?
  63.             handler : this.createWindow,?
  64.             scope: this?
  65.         }?
  66.         /* XML PERSONS OBJECT */?
  67.  ?
  68.         //Load the Module by requesting its definition XML from the server?
  69.         var app = PTS.ApplicationManager.loadApplication("PersonDetails_File");?
  70.  ?
  71.         //Get the Person Details View object?
  72.         view = app.getView("PersonDetailsGridView");?
  73.  ?
  74.         //Create the Ext Js Store and ColumnModel objects from the PTS View object?
  75.         store = view.getDataModel(new PTS.DataView.Ext.ExtDataStoreAdapter());?
  76.         colModel = view.getFieldModel(new PTS.DataView.Ext.ExtColumnModelAdapter());?
  77.  ?
  78.         var viewFilters = view.getFieldFilters(true);?
  79.  ?
  80.         var filtersForm = $("<div id=\"filtersdiv\"><form id=\"filtersform\" method=\"post\" action=\"\"><div id=\"autofilters\"></div><button onclick=\"applyFilters(); return false;\">Apply Filters</button><button onclick=\"clearFilters(); return false;\">Clear Filters</button></form></div>");?
  81.     var filtersFormFilterContainer = filtersForm.find("#autofilters");?
  82.  ?
  83.         //Get chart views for this module?
  84.         chartViews = app.getViewsByType("ChartView");?
  85.  ?
  86.         //function to recursively draw the filters for each view/sub-view?
  87.         var drawFilters = function(filters,drawElem)?
  88.         {?
  89.                 for(var i = 0; i < filters.length; i++)?
  90.                 {?
  91.                         var filter = filters[i];?
  92.                         if(filter.filter.length)?
  93.                         {?
  94.                                 //Filter is a subview and has an array of filters as its value?
  95.  ?
  96.                                 //Draw a fieldset?
  97.                                 var fieldSet = $("<fieldset style=\"width:25%\"></fieldset>");?
  98.                                 fieldSet.append("<legend>"+filter.fieldLabel+"</legend>");?
  99.                                 //Recursively draw all child filters?
  100.                                 drawFilters(filter.filter,fieldSet);?
  101.                                 drawElem.append(fieldSet);?
  102.                                 drawElem.append("<br/>");?
  103.                         }?
  104.                         else?
  105.                         {?
  106.                                 drawFilter(filter.filter,drawElem);?
  107.                         }?
  108.                 }?
  109.         };?
  110.  ?
  111.         //Draws an individual filter?
  112.         function drawFilter(filter,drawElem)?
  113.         {?
  114.                 //Get the label to use for the filter edit?
  115.                 var filterLabel = filter.label;?
  116.  ?
  117.                 //Draw a different edit control depending on the filter type?
  118.                 if(filter.type == "text")?
  119.                 {?
  120.                         drawElem.append("<label>"+filterLabel+": </label><input class=\"extfilter\" id=\""+filter.field.replace(/\./g,"-")+"\" type=\"text\"/><br/>");?
  121.                 }?
  122.                 else if(filter.type == "select")?
  123.                 {?
  124.                         var selHTML = "<label>"+filterLabel+": </label><select class=\"extfilter\" id=\""+filter.field.replace(/\./g,"-")+"\"><option value=\"\"></option>";?
  125.                         for(var j = 0;  j < filter.filterOptions.length; j++)?
  126.                                 selHTML += "<option value=\""+filter.filterOptions[j].value+"\">"+filter.filterOptions[j].text+"</option>";?
  127.                         selHTML += "</select><br/>";?
  128.                         drawElem.append(selHTML);?
  129.                 }?
  130.         }?
  131.  ?
  132.         drawFilters(viewFilters,filtersFormFilterContainer);?
  133.  ?
  134.     personModuleFilterHTML = $("<div></div>").append(filtersForm);?
  135.     personModuleFilterHTML = personModuleFilterHTML.html();?
  136.  ?
  137.  ?
  138.         function clearFilters()?
  139.         {?
  140.                 $(".extfilter").val('');?
  141.                 view.clearFieldFilters(true);?
  142.         }?
  143.  ?
  144.  ?
  145.  ?
  146.     },?
  147.  ?
  148.     createWindow: function() {?
  149.         var desktop = this.app.getDesktop();?
  150.         var win = desktop.getWindow('grid-win');?
  151.         if(!win) {?
  152.             win = desktop.createWindow ({?
  153.                 id: 'grid-win',?
  154.                 title: 'Person Module',?
  155.                 width: 824,?
  156.                 height: 630,?
  157.                 iconCls: 'icon-grid',?
  158.                 shim: false,?
  159.                 animCollapse: false,?
  160.                 border: false,?
  161.                 constraintHeader: true,?
  162.  ?
  163.                 layout: 'border',?
  164.                 defaults: {?
  165.                     collapsible: false,?
  166.                     split: true,?
  167.                     border: false,?
  168.                     frame: false?
  169.                 },?
  170.                 items: [?
  171.                     {?
  172.                         title: false,?
  173.                         region: 'north',?
  174.                         height: 25,?
  175.                         items: myTopToolbar?
  176.                     },{?
  177.                         title: 'Search Pane',?
  178.                         region: 'west',?
  179.                         collapsible: true,?
  180.                         width: 150,?
  181.                         layout: 'accordion',?
  182.                         items: [{?
  183.                                 title: 'Search',?
  184.                                 html: personModuleFilterHTML?
  185.                         },{?
  186.                                 title: 'Saved Searches',?
  187.                                 html: 'Saved Search Results'?
  188.                         }]?
  189.                     },{?
  190.                         title: 'Data',?
  191.                         region: 'center',?
  192.                         items:?
  193.                             new Ext.TabPanel({?
  194.                                 activeTab: 0,?
  195.                                 items: [?
  196.                                     {?
  197.                                         title: 'Persons',?
  198.                                         xtype: 'grid',?
  199.                                         loadMask: true,?
  200.                                         height: 500,?
  201.                     store: store,?
  202.                     cm: colModel,?
  203.                     stripeRows: true,?
  204.                     bbar: new Ext.PagingToolbar({pageSize: 10, store: store, displayInfo: true})?
  205.                                     },{?
  206.                                         title: 'Charts & Graphs',?
  207.                                         afterRender: drawChartView(),?
  208.                                         id: 'personsChart'?
  209.                                     }?
  210.                                 ]?
  211.                             })?
  212.                     }?
  213.  ?
  214.                 ]?
  215.             })?
  216.         }?
  217.         win.show();?
  218.     }?
  219. });?
  220.  ?
© 2011 Code Tidy  Terms and conditions