Re: CFWindow Refreshing the parent page
Yep, your right it is not a parent. I learned that in my journey trying to figure out this issue. Just part of the page that you can stick out there by itself for a minute. Understanding this concept does help a great deal when using cfwindow. Wish I would have grasped that at the very beginning. On Mon, Feb 2, 2009 at 8:00 AM, Andrew Scott andrew.sc...@aegeon.com.auwrote: Can you please explain to me why you call it the parent page? From what I can tell the cfwindow is called from the page request called, if that is the case there is no such thing as a parent page!! Even though it looks like a window and behaves like a window, doesnt make it a child in the context of a window in a browser. If you do a views ource, you will notice that it is just div containers in the page. What that means is that you dont reference it with parent.functionName() as you would with normal JS and browser windows. Just dont confuse yourself more by calling it a parent. Parent and such is more of a reference for JS when you open a window from within JS with the document.open(). Regards, Andrew Scott On Sun, Feb 1, 2009 at 1:21 PM, Nando d.na...@gmail.com 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=labelPin yin/td td
Re: CFWindow Refreshing the parent page
Can you please explain to me why you call it the parent page? From what I can tell the cfwindow is called from the page request called, if that is the case there is no such thing as a parent page!! Even though it looks like a window and behaves like a window, doesnt make it a child in the context of a window in a browser. If you do a views ource, you will notice that it is just div containers in the page. What that means is that you dont reference it with parent.functionName() as you would with normal JS and browser windows. Just dont confuse yourself more by calling it a parent. Parent and such is more of a reference for JS when you open a window from within JS with the document.open(). Regards, Andrew Scott On Sun, Feb 1, 2009 at 1:21 PM, Nando d.na...@gmail.com 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=labelPin 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=labelGewicht/td tdinput type=text class=text name=weight value= style=width:50px; //td /tr /table !--- instead of type=submit, this uses type=button --- div align=right
Re: CFWindow Refreshing the parent page
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 d.na...@gmail.com 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=labelPin 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=labelGewicht/td tdinput 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
Re: CFWindow Refreshing the parent page
Can you post a snippet that illustrates the problem. The other thing to remember is that CFWindow is not a child to the browser, it is actually just a div container within the HTML document that with style sheets changes the look of the div to look like a window. As I have done what you are looking for, I am still unclear what you are trying to achieve. On Sat, Jan 31, 2009 at 12:53 PM, David Mineer min...@gmail.com 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:318710 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CFWindow Refreshing the parent page
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=labelPin 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=labelGewicht/td tdinput 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 min...@gmail.com wrote: I am using a cfwindow that opens and displays some ajax based cfselects and a 2 date selection input fields. This all works
CFWindow Refreshing the parent page
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:318695 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4