*tumble weeds* :) I'll have another crack at this some time and update with results but will keep these cookies fresh in case anyone has any ideas!
*Peter Anders Hvass* - *http://theru.in <http://theru.in>* On Fri, May 22, 2015 at 4:25 PM, Peter Hvass <pe...@theru.in> wrote: > Hello all, > > tl;dr - need to push a BeanEditContext before AjaxUpload's upload event > and pop just afterwards. > > I've been playing around with this; > https://gist.github.com/xfyre/83f82f6e5145ee041217 > > It appears to be based on Tawus' AjaxUpload component here; > https://github.com/tawus/tawus/tree/master/tawus-ajaxupload > > The difference being the client-side scripts use a different library and > have been updated for 5.4's Require.js stuff. > > When you select a file to upload, a server-side event entitled 'upload' is > triggered via XHR. > > Unfortunately this doesn't play nice with my custom property blocks that > rely on accessing BeanEditContext through the environment. > > BeanEditContext is pushed using FormSupport in components like > BeanEditForm - both for the duration of a form action and during render. > > I've been toying around trying to figure out a way that I could push/pop > BeanEditContext before and after the upload event but have been failing > (hard) so far. > > I was just wondering if anyone else may already have tackled this - any > ideas? > > I was thinking about trying to intercept the upload event (couldn't find > anything that would let me do this - i.e.: a more generic FormSupport sort > of 'doohickey'). > > (For some background; I set up a data type and custom property block to > catch uploads of files related to my database layer; this is lovely - it > lets me generically handle create/update/display pushing/deleting files on > Amazon S3 and storing/replacing their metadata in the database. I'm using > Apache Cayenne - so the delete side of things is handled nicely by a > pre-removal event listener on that end. This works nicely for the standard > Upload component but when zones come into play, not so much. Enter > AjaxUpload component. This is for an inline-editable grid-type component I > use (click cell -> reveal form+field -> change -> persist to database). > > Thanks a ton! > Peter >