All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Low Variables - Grid data not saving with EE v2.9

Christiaan Knol 7 Aug 2014 02:33 problem, complete

I've just installed a fresh EE 2.9 site with Low Variables, however using the Grid field results in no data being saved.

I can create the grid and see the grid, however anything I add to the grid isn't saved and consistently get

"You have not added any rows of data yet. Add some data?"

Have tried numerous test of different grids with same result...

Christiaan

Replies

  1. Christiaan Knol 7 Aug 2014 03:00

    Adding another grid to the group I'm now getting an error (with a single grid there was no error - it just went back to the page, essentially refreshing without saving data).

    Changes saved, except for:

    Award Details

    You are not authorised to perform this action.

    I now get the above error when trying to save (Award Details is a simple grid, 2 columns text only).

    I'm the only user, and Super Admin.

    Christiaan

  2. Low 7 Aug 2014 09:38

    I can see what's happening, but I'm not sure where the responsibility lies here. I'd recommend reporting this with EllisLab as well, as it looks like it's a problem with their Content Types feature.

    I will contact EL (next week, after my holidays) as well to see where exactly the problem lies.

    FWIW: I initiate the Grid fieldtype with the low_variables content type, but when I call Grid's validate() method, the 'entry_id' property is empty for the Grid field, causing the 'get_entry_rows()' method to return an empty array, thus always throwing the 'not authorised' error. So I'm thinking the main issue is somewhere inside the validate() method or functions called therein.

  3. Christiaan Knol 7 Aug 2014 23:43

    Thanks - have reported with EL along with your response for reference.

    ref: https://support.ellislab.com/bugs/det...

  4. Christiaan Knol 10 Aug 2014 22:09

    EL have issued a patch / fix which resolves the issue with their Grid field type.

    https://support.ellislab.com/bugs/det...

  5. Christiaan Knol 11 Aug 2014 00:08

    Actually, it solves the grid issue in standard entries, however, not when used in a Low Variable.

    I can add entries initially and save them via Low Variable (which I couldn't before the patch). But I then can't add any more or delete existing rows to a grid entry. It seems to appear 'locked' once an initial save is performed.

    Christiaan

  6. Low 11 Aug 2014 11:40

    OK, this is still an EE issue, but you can work around it with a hack in the types/low_grid/vt.low_grid.php file. Open it up and look up line 235, which reads

    $this->ft->_init($data);
    Directly below that, add a new line which reads:
    $this->ft->settings['entry_id'] = $var_id;
    That should allow it to be saved again.

    However, I'm still not convinced this is a LV issue, but rather wrong presumptions made by Grid. I reckon I shouldn't explicitly set the entry_id setting, but rather Grid should know this depending on the Content Type (there's no entry_id in LV). Here's what I do when saving a Grid field, using its API and content type feature:
    • I set up the Grid fieldtype using the main _init() method available in the EE_Fieldtype class, setting the id, name, content_id and content_type properties.
    • I then call the validate() method of the Grid fieldtype
    • Grid includes the Grid_lib library and initiates it, looking for an 'entry_id', which it doesn't find
    • Grid tries to get the allowed rows for this instance, but finds none, because of the empty 'entry_id'
    Adding 'entry_id' to the _init() method doesn't help, as it's not a valid property for the global EE_Fieldtype class. I think EllisLab should revisit their code and make less use of the entry_id paradigm if they want their content types to work properly across the board.

  7. Christiaan Knol 15 Aug 2014 01:37

    Thanks - your fix is working for us now at least.

    I had to revert EL's "Known Fix" back to the original 2.9 files.

    Their fix still rendered the Grid unable to save data beyond the first save. Removing their fix and applying your fix is now working.

  8. ZenBug 7 Sep 2014 21:14

    I'm having the same issue but neither fix has resolved it for me. I'm actually on EE 2.8.1 and Low Variables 2.5.0.

    Low 8 Sep 2014 07:21

    Can't seem to be able to reproduce this on EE 2.8.1. Are you sure it's exactly the same behaviour?

    ZenBug 8 Sep 2014 13:31

    I may have been mistaken, but anyway, I just took the plunge and updated to 2.9 and was able to fix it with your suggestion, so I guess you can disregard this.

  9. wjthomas9 1 Oct 2014 20:08

    This works fine for me with the grid patch from EL. I'm only mentioning that because someone else said they had problems with this until they undid the EL patch.

  10. wjthomas9 1 Oct 2014 20:09

    Will there be any need to "undo" this if/once it's fixed on EL's side?

  11. Low 2 Oct 2014 08:23

    No, you can safely keep this patch. I will probably have to add it into the core anyway, as EllisLab tweaks their API. 

  12. wjthomas9 2 Oct 2014 17:14

    Ok. I'll keep it. Although, Kevin did update the grid patch to fix this without needing your patch. Their patch works both with and without your patch.

  13. spatafore 30 Sep 2015 07:11

    this is not "offially" fixed? you know without the path?

    I'm on EE v2.10.1 with low variables 2.6.1 and still Don't Works.

    any help?
    thank you

    Low 30 Sep 2015 07:49

    To avoid notifying others in the thread, I created a new conversation to continue the discussion.

    Please reference the new conversation here: Grid in LV not saving in EE2.10.1