I have a grid in a coldfusion flash form.
Users do not enter information directly into the grid. They enter data into a "Details Section" which is a collection of form items (textbox, selectbox, etc) bound to the grid.
I have actionscript which changes the values in the grid based on user entries.
The actionscript works properly because after making a change in the details screen and mousing over the selected record in the grid. The selected record updates values appropriately.
However, the grid onchange event uses the same code to update the values. When a grid value is changed, the values in the grid do not appear to update.
It is some type of refresh issue but I'm not sure how to开发者_StackOverflow中文版 fix it. Any ideas?
I cannot ever argue the wise words of Mr. Camden as seen above. I've read 2 of his books on ColdFusion Web Application design called, "ColdFusion Web Application Construction Kit vols 1 & 2." and they were phenomenal! He's one of my big heroes of the ColdFusion "community" out here.
In those books he does show (and numerous snippets are available online from those), on how to properly use flash forms on coldfusion web pages using {CFINSERT}, {CFUPDATE} and etc., and even "those tags" are highly recommended (against) utilizing.
But, if he's strongly suggesting you use a proper Flex or Flash application (altogether) to display your grid data, then I'd (also) recommend your taking his advice.
For CF pages:
You might look in to doing an AJAX call to requery your data for your grid upon insert/update/delete. http://www.raymondcamden.com/index.cfm/2007/8/20/Custom-grid-renderers-with-CFGRID http://www.raymondcamden.com/index.cfm/2007/8/9/Reacting-to-grid-row-selection
also try:
tutorial1(dot)learncf(dot)com/ ( a great tutorial with working [paged] datagrid demo )
Otherwise in a Flash Application yes, several approaches. I haven't seen {your} CF code, but in a traditional flash application (where you're viewing an embedded .swf on a webpage) if that "ever" happened on a flash application:
I'm pretty certain the problem would stem from needing to re-call the binder for the datagrid {after whatever update method you are using, is called}, like so:
var dp:DataProvider = new DataProvider(pEvt.result); details_dg.dataProvider = dp; // this binds/rebinds your datasrc to details_dg // note: use .dataProvider not DataGrid.addColumn(), its much faster. // {note: this is of course, incomplete code because obviously you'll have // your own datasource wire-up instead of the pEvt object here, etc.}
Additionally, you might "try" creatively adding an event listener to your grid such that when it's say; sorted, a mouse over, or a refresh button is pressed or whatever, {I generically used "headerRelease" here}, but anything you need, assuming that "details_dg" is your datagrid, like so:
details_dg.addEventListener("headerRelease",this); function headerRelease(evtObj:Object):Void { //... add any prelim items needed. //... add code to refresh grid from datasource here details_dg.dataProvider = dp; //this re-binds/refreshes your datasrc to details_dg. }
Recommend implementing any sort of "forced" refreshes "sparingly" though, especially if you have numerous records, and considering your audience's workstation speed as well as their internet connection, etc.
Anyway, FLEX is MUCH nicer if you wish to make a proper datagrid enabled, web application.
Hoping that helps!
精彩评论