Nando,

Thanks for the reply. This got me going down the right path.  As you
mentioned I also seemed to be having an issue where the values were
persisted after the page was refreshed causing them not to show up correclty
on the main page.

The solution for me was to use :

<cfajaxproxy bind=
"cfc:path.to.cfc.function({value1},{value2},{value3},{value4},{value5})" />
I created a cfc in a folder I use just for ajax stuff.  The function
accesses one of my gateways which uses already existing functionality.

This worked great.  I can't beleive how hard it was.  Thanks for your
comments and assistance.  This really is my first use of cfajaxproxy. I
learned alot, hopefully I can remember it now.
On Sat, Jan 31, 2009 at 7:21 PM, Nando <[email protected]> wrote:

>
> I also had to tackle this problem in the particular context of the data in
> a
> cfgrid. I didn't need to refresh the whole page, but the problem seem to be
> that the grid would refresh before the changes made in the cfwindow fields
> were persisted. Perhaps the same is happening in your case?
>
> The solution I came up with was to use cfajaxproxy to set up means to
> persist data via a javascript and submit the form to a javascript method on
> the parent page. That way, the steps can be sequenced.
>
> Here's some sample code, copied from a working implementation that you can
> probably adapt.
>
> // set up the proxy and import the ext library needed to build the buttons
> i
> use ...
>
> <cfajaxproxy cfc="remote.RemoteGateway" jsclassname="dataproxy">
> <script type="text/javascript"
> src="/CFIDE/scripts/ajax/ext/package/toolbar/toolbar.js"></script>
>
> <script type="text/javascript">
>    var dataproxy = new dataproxy();
>
> // set up grid, adding buttons with handlers
>
>    function initGrid() {
>        grid = ColdFusion.Grid.getGridObject("RecipeHerbGrid");
>        var gridFoot = grid.getView().getFooterPanel(true);
>        var bbar = new Ext.Toolbar(gridFoot);
>        bbar.addButton({
>        cls:"x-btn-text-icon",
>        icon:"icons/add.png",
>        handler:onAdd
>        });
>        bbar.addSeparator();
>        bbar.addButton({
>        text:"Delete Selected",
>        cls:"x-btn-text-icon",
>        icon:"icons/delete.png",
>        handler:onDelete
>        });
>    }
>
> // this method is fired when the Add button is clicked, opening the add
> recipe window
>
>    function onAdd(button,event){
>        ColdFusion.Window.show('addRecipeHerbWindow');
>    }
>
> // when the Save button is clicked in the form in the add recipe window, it
> calls this function
> // NOTE: the button in the form is not a type="submit" - it's a
> type="button" - this is important
> // this function acts as a proxy to the addRecipeHerb() method in the
> remote.RemoteGateway CFC
> // so in effect, the form submission is persisted, then the window is
> hidden,
> // and then the grid is refreshed. You could refresh the whole page if
> needed at this point
>
>    function addRecipeHerb() {
>        var f = document.frmRecipeHerb;
>        dataproxy.addNewRecipeHerb (
>            f.recipeVariationId.value,
>            f.herbId.value,
>            f.weight.value
>        );
>        ColdFusion.Window.hide('addRecipeHerbWindow');
>        ColdFusion.Grid.refresh('RecipeHerbGrid', true);
>    }
>
> // here are the functions for the delete button to make it complete
>
> var grid = ColdFusion.Grid.getGridObject("RecipeHerbGrid");
>    var record = grid.getSelections();
>    // remember, CF makes column names to all UPPERCASE, so dont forget to
> do that
>    dataproxy.deleteRecipeHerb(record[0].data.RECIPEHERBID);
>    }
>    ColdFusion.Window.hide('deleteRecipeHerbWin');
>    ColdFusion.Grid.refresh('RecipeHerbGrid', true);
>    }
>
>    function editRecipeHerb() {
>        var grid = ColdFusion.Grid.getGridObject("RecipeHerbGrid");
>        var record = grid.getSelections();
>        dataproxy.editRecipeHerb (
>            record[0].data.RECIPEHERBID,
>            record[0].data.THEWEIGHT,
>            record[0].data.PINYIN
>        );
>        ColdFusion.Grid.refresh('RecipeHerbGrid', true);
>    }
>
> // and the cfwindow code block. Note again that the submit buttons are
> type="button"
>
> <cfwindow closable="true" modal="true" name="addRecipeHerbWindow"
> title="Add
> Recipe Herb" width="250" height="140" x="300" y="250">
>    <form name="frmRecipeHerb">
>        <input type="hidden" name="recipeVariationId"
> value="#qMainRecipeVariation.recipeVariationId#">
>        <table cellpadding="0" cellspacing="0" border="0">
>            <tr>
>                <td class="label">Pin yin</td>
>                <td>
>                    <select name="herbId" style="width:150px;">
>                        <cfloop query="qPinYinList">
>                            <option class="l1"
> value="#herbId#">#pinYin#</option></cfloop>
>                    </select>
>                </td>
>            </tr>
>            <tr>
>                <td class="label">Gewicht</td>
>                <td><input type="text" class="text" name="weight" value=""
> style="width:50px;" /></td>
>            </tr>
>        </table>
>        <!--- instead of type=submit, this uses type=button --->
>        <div align="right" style="margin:10px 0 0 0;"><input type="button"
> class="submit" value="Save" onclick="javascript:addRecipeHerb();" /></div>
>    </form>
> </cfwindow>
>
> <cfwindow width="250" height="140" x="300" y="250"
> name="deleteRecipeHerbWin" modal="true" resizable="false" title="Delete
> Recipe Herb?">
>    <div style="margin-left:5px;margin-top:5px;">
>    Delete the selected herb from the recipe?
>    <div align="center" style="padding-top:6px;">
>        <input type="button" value="Yes" onClick="deleteRecipeHerb('yes')">
>        <input type="button" value="No" onClick="deleteRecipeHerb('no')">
>    </div>
> </cfwindow>
>
> It took me quite awhile over the last few days to get this to work ... so I
> hope it helps you.
>
> Nando
>
> On Sat, Jan 31, 2009 at 2:53 AM, David Mineer <[email protected]> wrote:
>
> >
> > I am using a cfwindow that opens and displays some ajax based cfselects
> and
> > a 2 date selection input fields.
> >
> > This all works except when I close the window, the parent page does not
> > refresh the values.  The page seems to refresh and I know the values have
> > been correctly set,  but they do not show up.  I am sending a
> > document.location.reload() in the onclick of the submit button as well as
> > the coldfusion.window.hide.
> >
> > I have seen a few posts on exactly this same thing but the answers are
> not
> > clear to me.  I have toyed with coldfusion.navigate and other recommended
> > solutions but nothing is working.
> >
> > Does anyone have any suggestions?
> >
> >
> > --
> > David Mineer Jr
> > ---------------------
> > The critical ingredient is getting off your
> > butt and doing something. It's as simple
> > as that. A lot of people have ideas, but
> > there are few who decide to do
> > something about them now. Not
> > tomorrow. Not next week. But today.
> > The true entrepreneur is a doer.
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318721
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to