How to attach inline_edit (add_edit) manually

edited September 2011 in Feature Requests
I'd like to obtain the same functionality (inline editing of an entry) as with the form_fields 'add_edit' class, just outside of the form_fields method. So, what do i have to do in order to have JS attach itself to an 'a' element with

class="add_edit btn_field edit_inline_button"
?

I suspect it has to do with JQX but I can't really find out more...
any help would be greatly appreciated!

Comments

  • edited 3:08PM
    Currently, the javascript functionality for that exists in 2 places. The first is in fuel/modules/fuel/assets/js/fuel/controller/BaseFuelController.js in the _initAddEditInline method which takes care of the admin. The second place is for inline editing and it exists in the fuel/modules/fuel/assets/js/fuel/edit_mode.js file.

    As an FYI, this will be changing quite a bit in the next release to be more simplified and modular. No timeframe yet on it though but will say I was working on it quite a bit yesterday.
  • edited 3:08PM
    ok so is loading these 2 scripts inside my view enough to have the handler attached to my element? thanks!
  • edited September 2011
    (doesn't look like it... getting console errors )

    edit: if u have time/patience, could you explain me what this does

    $this->js_controller_params['method'] = 'add_edit';
    as found in several controllers?
    thanks a lot
  • edited 3:08PM
    That tells jqx which method in the controller to execute on load after the initialization of the controller. The BaseFuelController.js is the default jqx controller loaded if no jqx Controller is specified. However, in some modules, they use their own Controllers that inherit from BaseFuelController and in some cases override that method (e.g. PageController).

    The add_edit method gets executed on the create/edit pages for modules.
  • edited 3:08PM
    so in order to have an element with the class 'add_edit' be attached to the add_edit JS handler, is it enough to add


    $this->js_controller_params['method'] = 'add_edit';

    to the relevant controller? (ie the one that's rendering the backend view in my case)?
  • edited 3:08PM
    I think that should work. That would execute the add_edit method in the jqx controller. It just so happens that the name of the CSS class is also "add_edit" but the only relation between the two is that the jqx "add_edit" method contains the code that creates those add/edit buttons (among other things).
  • edited 3:08PM
    gonna have to check carefully - i thought adding the add_edit class to an element would be enough for the jqx script to hook it up
Sign In or Register to comment.