4

I looked at the documentation in ExpressionEngine about saving/updating a channel entry row.

Unfortunately, the documentation doesn't show anything about adding a new Grid row.

Is it possible to do this? If so, how?

0

I hope this still helps,

I add new rows to a grid field by this code:

$data['field_id_X']['rows']['new_row_Y']['col_id_Z'] = 'value';

Just match X to your grid's field ID, increment new_row_Y as needed and match up your col_id_Z numbers.

| improve this answer | |
0

I'm not really sure if it's possible to do this in a native way with the Channel Entries API, if someone knows a way please post.

However, I believe you can do grid field updates in your add-ons by using the EE Database Class and inserting/updating the corresponding grid table directly with a mysql query.

If you examine your database tables, you will see that grid fields create their own tables, named exp_channel_grid_field_## (where ## is your field number).

You'll also see that each exp_channel_grid_field_## entry is associated by entry_id to the corresponding channel_title entry_id, and each column_id_# is for the corresponding column you've set within the grid.

| improve this answer | |
  • 1
    Yeah, this solution is what I will use if I could not find any API that will work. – developarvin Jun 6 '14 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.