question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Client side grid columns are not bound to server side properties

See original GitHub issue

We have a client side configured grid and want to attach the data with a data provider on the server side to provide lazy loading while the client side can be designed by an UX designer. When solely using grid.setDataProvider the Grid shows empty rows (where the number of rows is calculated correct).

It seems that the properties of the beans are not automatically bound to the grid.

When adding columns from the server side by using a template renderer and withProperty, the properties are bound to the grid and also used from the server side.

Example polymer template code

<vaadin-grid id="project-list" theme="compact no-row-borders">
    <vaadin-grid-column flex-grow="4">
          <template class="header">
                <div class="header-item">Project Name</div>
          </template>
          <template class="data-item customer-list">
                 <div class="customer-list">
                        [[item.name]]
                 </div>
          </template>
    ...

Binding the data provider

projectGrid.setDataProvider(DataProvider.<ProjectDPO, Object>fromFilteringCallbacks(...));

This combination leads to the empty results. We have to add a new column on server side with the following code. After that, also the client side configured conten is shown correctly.

projectGridd.addColumn(TemplateRenderer.of(...).withProperty("name", ProjectDPO::getName));

This should not be needed, since the additional column is unnecessary. The property binding should work automatically out of the box.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stefanuebecommented, Jun 4, 2018

Yep, sounds good.

I helped myself with the following solution as a workaround. Creates a simple renderer, binds needed properties to the grid and hides the “utility” column.

TemplateRenderer<ProjectDPO> renderer = TemplateRenderer.<ProjectDPO>of("");

renderer.withProperty("name", ProjectDPO::getName);
renderer.withProperty("budget", ProjectDelegate::getBudget);
// ...

Column<ProjectDPO> column = addColumn(renderer);
column.setId("___property_provider___");
column.setVisible(false);
0reactions
Legiothcommented, Jun 13, 2018

Seems like this is a duplicate of vaadin/vaadin-grid-flow#62.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Client-side bound RadGrid does not provide server ...
Hi, I have a RadGrid that I bind client-side using data from a call to a WCF web service. The call is done...
Read more >
Server-Side Row Height
For Server-Side Row Model the row height cannot be changed once it is set. In the example below, the following can be noted:...
Read more >
Support null columns on grid
You have to use ClientTemplate : columns.Bound(x => x.PrimaryContact.EmailAddress) .ClientTemplate("#=PrimaryContact ? PrimaryContact.
Read more >
Grid Level Properties
If omitted, client-side sorting is used. The response represents the name of the field bound to the first widget in a column of...
Read more >
jQuery Grid Unbound Column: How to make the most of it
It is relevant when defining a grid on the server-side with the ASP.NET MVC wrapper. The default option is false and what happens...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found