Filter CFgrid with Flash Remoting (Problem)

Ask a Question related to Coldfusion Flash Integration, Design and Development.

  1. #1

    Default Filter CFgrid with Flash Remoting (Problem)

    :confused;

    I can't seem to figure out why the filter as you type feature isn't working.
    When I type some text in the text-box it clears the grid. I can't get it to
    work with Flash Remoting.



    <cfsilent>
    <!--- make an empty query to populate the grid with no records --->
    <cfset memberList = queryNew("CustName,TechCode") />
    </cfsilent>

    <
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Populating a cfgrid with Flash Remoting</title>
    </head>

    <body>
    <cfform name="myform" height="550" width="499" format="Flash" timeout="300"
    onload="onFormLoad()">
    <cfformitem type="script">
    function onFormLoad(){
    var listener:Object = {};

    //put the controls in scope to avoid calling _root

    var getData:Function = getData;
    var search:Function = search;
    var whereismytech:mx.controls.DataGrid = whereismytech;


    listener.modelChanged = function(evt):Void {
    alert('Data loaded... clear datagrid until department is selected');

    whereismytech.removeEventListener('modelChanged',l istener);

    <!--- empty search, should return no value --->

    search('',whereismytech,[]);
    }

    listener.search = search;

    getData();

    whereismytech.addEventListener('modelChanged',list ener);
    }

    function getData():Void{
    <cfoutput>
    //create connection

    var connection:mx.remoting.Connection =
    mx.remoting.NetServices.createGatewayConnection(
    "http://#cgi.HTTP_HOST#/flashservices/gateway/";);
    //declare service

    var myService:mx.remoting.NetServiceProxy;
    </cfoutput>

    var responseHandler:Object = {};

    //put the controls in scope to avoid calling _root

    var whereismytech:mx.controls.DataGrid = whereismytech;


    responseHandler.onResult = function( results: Object ):Void {
    //when results are back, populate the cfgrid
    whereismytech.dataProvider = results;

    mx.managers.CursorManager.removeBusyCursor();
    }

    responseHandler.onStatus = function( stat: Object ):Void {
    //if there is any error, show an alert
    alert("Error while calling cfc:" + stat.description);
    mx.managers.CursorManager.removeBusyCursor();
    }

    //get service, make sure you write the correct path
    myService =
    connection.getService("/Working-Remoting/xxxx/flashRemotingResponder",
    responseHandler );
    mx.managers.CursorManager.setBusyCursor();
    //make call

    myService.getMembers();
    }

    <!--- search function --->
    function search( term:String, grid:mx.controls.DataGrid, columns:Array ):Void {

    var filterTerm:String = term.toString().toLowerCase();

    if(_global.unfilteredData[whereismytech.id] == undefined){
    if (_global.unfilteredData == undefined){
    _global.unfilteredData = {};
    }
    _global.unfilteredData[whereismytech.id] = grid.dataProvider.slice(0);
    }

    if(filterTerm.length > 0) {

    var filteredData:Array = [];

    for(var i = 0; i< _global.unfilteredData[grid.id].length; i++) {
    var item:Object = _global.unfilteredData[grid.id][i];
    var added:Boolean = false;

    for(var j = 0; j< columns.length; j++){
    if(!added){
    var value:String = item[columns[j]].toString().toLowerCase();
    if(value.indexOf(filterTerm) != -1) {
    filteredData.push(item);
    added = true;
    }
    }
    else {
    break;
    }
    }
    }

    grid.dataProvider = filteredData;

    }
    else
    {
    if (_global.unfilteredData[grid.id] != undefined)
    {
    grid.dataProvider = _global.unfilteredData[grid.id];
    }
    }
    }
    </cfformitem>
    <cfinput type="text" name="secondTerm"
    onchange="search(secondTerm.text,whereismytech,[column.selectedItem.data])"
    width="90" label="Filter by:">
    <cfselect name="column" label="in:" onchange="secondTerm.text=''"
    width="90">
    <option value="CustName">CustName</option>
    <option value="Job_ID">Job ID</option>
    <option value="Supvsr">Supvsr</option>
    <option value="CustAddr">CustAddr</option>
    </cfselect>

    <cfgrid name="whereismytech" query="memberList" height="200"
    rowheaders="false" >
    <CFGRIDCOLUMN NAME="TechCode" header="Tech Code">
    <CFGRIDCOLUMN NAME="CustName" HEADER="CustName">

    </cfgrid>
    <cfinput type="button" name="getValues" value="Populate data grid" >
    </cfform>
    </body>
    </html>

    nightkiller211 Guest

  2. Similar Questions and Discussions

    1. CFGRID refresh and Flash Remoting Services
      hello all, I have the following problem: I am using Flash Remoting Services to populate a cfgrid during the form "onload". Works fine on my...
    2. ColdFusion and Flash Remoting Gateway problem
      Ok here is the setup: FlashMX2004 (not pro) Doing a very simple test run of remoting. I am working only localy so there is not actual server...
    3. problem with CFGRID flash data updating
      I am having problem with processing the data changes of CFGRID (flash format) in the action page. Enclosed please find a simple form...
    4. Flash remoting, getService() problem with dotteddirectories
      Hi all, I have a problem invoking a CFC function on a server. When invoking a CFC file from flash (or not) you refer to the file with dots (.)...
    5. Flash Remoting Web Services problem HELP!!!!
      The web service i'm consuming within flash is located at: http://www.bindingpoint.com/ws/imalert/imalert.asmx I am able to run the SendMSN method...
  3. #2

    Default Re: Filter CFgrid with Flash Remoting (Problem)

    isn't this supposed to be in dot notation instead

    myService = connection.getService("/Working-Remoting/xxxx/flashRemotingResponder", responseHandler );


    Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139