jeditable facepalming.

jeditable facepalming.

fbasfbas Posts: 1,094Questions: 4Answers: 0
edited August 2011 in Plug-ins
I'm getting stuck on an issue with jeditable. This isn't datatable's fault or a bug, but I still hope someone here might have some pointers. The documentation for jeditable is deplorable and I can't find any useful info for their API, in particular for creating custom "types", except for this incredibly vague page: http://www.appelsiini.net/2007/8/custom-input-types

What I'm working on is a "properties panel", in a visual developer style, that will be used for a DataTables wizard to help people rapidly set up DT projects. You can see the panel at http://www.beg.utexas.edu/_work/dt/propertieswindow.htm . This page works pretty fine with one small issue that I'm trying to address: when a user double clicks on a "value", a text is good for singleton types like numbers and strings, but for arrays, objects, and functions, I want to use a .

This brought me to the idea of setting up a custom type in jeditable, because I can intercept the cell being edited and check the type (defined in a hidden column in the table) and give the correct or . The problem I have, and maybe there's a simple explanation and fix, is that 1) after submitting (I just use a simple echo.php) the value is echoed to the user in an annoying alert() box and 2) the value of my cell is not changed at all. You can see this on http://www.beg.utexas.edu/_work/dt/propertieswindow2.htm .

I thought to try using a function instead of the echo.php page, and I can then get the system to stop with the annoying alert() and it also updates the field, but now there's an issue with DataTables. DataTables kicks off the fnRender, but the data value for that row and column is "undefined", which causes a javascript error, and the render function does not work. This is odd because using console.log shows that editable has created a nice cell that it will put back into the DOM, but I guess it hasn't gotten around it yet when fnRender is run. You can see this at http://www.beg.utexas.edu/_work/dt/propertieswindow3.htm

So.. any advice?

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    it seems to be freaking out only when I use a textarea as the type for editable, which is weird because I've used textarea with editable on other projects. I guess I'll check versions tomorrow to see if there's something different.
  • allanallan Posts: 56,444Questions: 1Answers: 8,957 Site admin
    Oooo - I like the concept of your project!

    This page looks like it might contain a possible answer for a custom control for jEditable with textareas: http://www.appelsiini.net/2008/4/autogrow-textarea-for-jeditable . You could just pull out the auto grow code from it and hopefully that will work. Not tested it yet (must fly to work...) but I can have a look later if that is of any help.

    Regards,
    Allan
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    The goal of the project is to provide a multi-stage wizard that let's people flexibly set up their data (import from or convert to , csv, json, db, etc), set object's values with the visual properties panels (data table initialization object, columns/defs objects, etc.), visually tweak sDom elements (probably some drag-and-drop and visual feedback), change CSS and display properties and get immediate visual feedback, add/remove extras/plug-ins.

    I imagine it will be offered as a zip file that one can run on their own site to generate their DataTables, or perhaps I'll put it up on a site that generates a custom package based on settings input by end-users. The one issue with having end-users run it on a remote site is that for DB related tables they would either have to manually enter all the data they want or they'd have to input a password into the system and trust that the owner of that site (me?) would not abuse that password.

    I had seen the autogrow page, and used those patterns; that's what led me to getting those issues where the results of the editable actions are not making it to the page, or are getting "undefined" values in DataTables for that element in the data array. I'll dig through the editable plug-in code to get a better understanding of the flow of things in the integration.
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    It was version related. dt editable 1.0 on my test machine, upgraded to 1.3.
This discussion has been closed.