Table Component - Column with input text fields

Get help with using Metro 4 components
Post Reply
Bitez
Posts: 5
Joined: Thu Mar 28, 2019 12:48 am
Status: Offline

Table Component - Column with input text fields

Post by Bitez » Thu Mar 28, 2019 12:56 am

Hello,

I'm using table component inside an asp.net mvc application. I've been able to create the table and also bind external json data and everything is working fine.

Now I need to have one of the column to expose an input type text to permit to update values.

I've been able to create fields, passing input type tag entirely inside the json, but i have problem with pagination.... when I change the page I lose changed values.

Which is the better way to avoid this problem?

Maybe it could be useful to implement an item for header to define input.

Thanks in advance.

Bitez

User avatar
olton
Site Admin
Posts: 194
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Mar 28, 2019 7:11 am

You can use onDrawCell event to create input inside a table cell

Bitez
Posts: 5
Joined: Thu Mar 28, 2019 12:48 am
Status: Offline

Post by Bitez » Thu Mar 28, 2019 11:42 am

But what happens when i paginate the table? Does the value inputed remains?

User avatar
olton
Site Admin
Posts: 194
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Mar 28, 2019 12:31 pm

The component currently does not support saving states of input fields. You can save values for example in Storage and restore them from there when drawing the input field

Bitez
Posts: 5
Joined: Thu Mar 28, 2019 12:48 am
Status: Offline

Post by Bitez » Thu Mar 28, 2019 12:32 pm

Ok, thanks!

User avatar
olton
Site Admin
Posts: 194
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Mar 28, 2019 12:49 pm

Also, you can use methods getItems, and setItems. getItems - return all items, stored in the component, then you update your need item (with input field) and use setItems to save items into the component. Method draw() - you can use for redraw table.

User avatar
olton
Site Admin
Posts: 194
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Mar 28, 2019 12:57 pm

I will try to add methods to facilitate this process in 4.2.40.

User avatar
olton
Site Admin
Posts: 194
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Mar 28, 2019 2:03 pm

This example created with dev version 4.2.40
https://sandbox.org.ua/olton/code/Vnbk1VI2m5

Bitez
Posts: 5
Joined: Thu Mar 28, 2019 12:48 am
Status: Offline

Post by Bitez » Thu Mar 28, 2019 2:21 pm

WONDERFUL!!!! That's Exactly what I need.

User avatar
olton
Site Admin
Posts: 194
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Mar 28, 2019 5:48 pm

each page of the table is redrawn, so the table cannot be used as a structure with input fields for the form

Post Reply