Data grid and Microflow question

0
I am having a dataview where data grid has been used, when I press a button it has to create a new row of the data grid. How to do that. I have created a microflow but the row is not creating . It's creating row tho with no values
asked
4 answers
1

This usually happen due to two reason, first, if the record is not associated to the dataview object and you forget to choose refresh in client option after you create the object

answered
0

Hi,

This usually happens when the object is created but not linked correctly to the DataView object.

If your page has a DataView (parent) and a Data Grid (child list), then just creating the new object is not enough. You must set the association between the DataView object and the new row.

Basic steps in the microflow:

  • Create the new object (the entity used in the Data Grid)

  • Set the association to the DataView object

  • Set any default values if needed

  • Commit the object and refresh in client

If the association is missing, the row may appear empty or not appear at all.

Once the association is set and the object is committed, the new row will show correctly in the Data Grid.

 

answered
0

The other answers are basically right, but the important bit is how the Data Grid actually works, which isn’t always obvious at first.

 

A Data Grid inside a DataView doesn’t show “all records”. It only shows the records that are linked to the DataView’s object. So when you create a new object in a microflow, that object exists, but the grid has no idea it belongs there unless you explicitly set the association to the parent object.

 

If that link is missing, the grid either shows an empty row or doesn’t show anything at all. That’s why it feels like the create didn’t work, even though it actually did.

 

The other common thing people miss is the UI refresh. Even if the association is set correctly, if you don’t commit with “refresh in client”, the page won’t update and you won’t see the new row right away.

 

So in short: creating the object is not enough. You need to link it to the parent, and then refresh the page so the grid can show it.

answered
0

You have:

  • A Data View

  • Inside the Data View, a Data Grid

  • A button that triggers a microflow

  • Expectation:When the button is clicked, a new row should appear in the Data Grid

  • Actual behavior:

    • A row is created in the database

    • But it appears empty (no values), or

    • Sometimes does not appear immediately

This is a very common Mendix beginner-to-intermediate issue, and the root cause is almost always a misunderstanding of context, associations, and refresh behavior.

Key Concept You Must Understand (Very Important)

A Data Grid does NOT show “all objects” by default.It only shows objects that match its data source AND context.

Creating an object alone is not enough.

For a new row to appear in a Data Grid:

  1. The object must be created

  2. The object must be associated correctly

  3. The grid must be refreshed

  4. Required attributes must be set before commit

If any one of these is missing, you will see exactly the issue you described.

Typical Setup (What You Most Likely Have)

Let’s assume a common structure:

  • Parent entity: Order

  • Child entity: OrderLine

  • Association:Order 1 — * OrderLine

UI:

  • Data View → Order

  • Inside Data View → Data Grid → OrderLine

Data Grid source:

  • XPath or Association:

    OrderLine_Order = '[%CurrentObject%]'
    

This setup is correct.

Why the Row Is Created but Shows No Values

Root Cause #1: Attributes Are Never Set

If your microflow does:

Create Object OrderLine
Commit

Then yes:

  • A row is created

  • But all attributes are empty

  • Data Grid shows a blank row

Correct Approach

You must set attributes before commit.

Example:

Create OrderLine
Change Object
    Quantity = 1
    Price = 100
    Description = 'New item'
Commit OrderLine
Refresh in client = Yes

Root Cause #2: Association to Parent Is Missing (MOST COMMON ERROR)

Even if you set attributes correctly, the row will not appear if the association is missing.

What usually happens

Microflow creates OrderLine, but does not link it to the Order.

Data Grid filter:

OrderLine_Order = '[%CurrentObject%]'

Your new object does NOT match this filter → grid stays empty.

Correct Microflow Logic (Step by Step)

Input parameter

  • Order (same entity as the Data View context)

Microflow Steps

  1. Create Object

    • Entity: OrderLine

  2. Set Attributes

    • Quantity

    • Price

    • Any mandatory fields

  3. Set Association

    OrderLine_Order = $Order
    
  4. Commit

    • Commit = Yes

    • Refresh in client = Yes

That’s it.

Now the Data Grid will immediately show the new row.

Root Cause #3: Refresh in Client = No

Even if everything else is correct:

If you commit with:

Refresh in client = No

The object exists in the database but:

  • UI does not refresh

  • User does not see the new row

Best Practice

Always use:

Commit → Refresh in client = Yes

For UI-driven actions.

Root Cause #4: Wrong Button Configuration

Common mistake

Button is:

  • Outside the Data View

  • Or not passing the correct context object

Correct setup

  • Button should be inside the Data View

  • Microflow parameter should be:

    Order (or the Data View entity)
    

If the button does not have the correct context, the association cannot be set properly.

Root Cause #5: Data Grid Is Read-Only but Attributes Are Mandatory

If:

  • The Data Grid is editable

  • But mandatory attributes exist

  • And values are not set

Mendix may:

  • Create the object

  • But block UI update silently

Always set all mandatory attributes in the microflow.

Recommended Best-Practice Pattern (Expert Way)

Use a Helper Microflow

Microflow name: MF_AddOrderLine

Input: Order

Steps:

  1. Create OrderLine

  2. Set default values

  3. Set association to Order

  4. Commit with refresh

This pattern:

  • Is clean

  • Avoids UI logic in pages

  • Works consistently across Mendix versions

Quick Checklist to Debug Your Case

Check each item carefully:

  • Are attributes set before commit?

  • Is the association to the parent object set?

  • Is Refresh in client = Yes?

  • Is the button inside the Data View?

  • Is the Data Grid filtering by association?

  • Are mandatory fields populated?

If any one of these is wrong, the behavior you described will occur.

Final Expert Summary

What you are seeing is expected Mendix behavior, not a bug.

The row is created but appears empty because:

  • Either attributes are not set

  • Or the association is missing

  • Or the UI is not refreshed

Once you:

  • Set values

  • Link the object correctly

  • Commit with refresh

The Data Grid will behave exactly as expected.

 

answered