JavaFX. Binding list of non-observables values with TableView -


this question has answer here:

i write application uses tableview in want represent , edit list of data.

i have data model.

public class cmodel  {     private list<citem> m_lstitems;      public list<citem> getlist()     {         return m_lstitems;     }  }  public class citem  {      private string m_sname;     private string m_stype;      public void setname(string s)     {         m_sname = s;     }      public string getname()     {         return new string(m_sname);     }  } 

if need bind data model can create observablelist(). doesn’t allow me observe items editing. make editing possible need inherit citem members observable. if declare property tableview observes items changes.

the problem if cmodel pure data model shouldn’t inherit observable (because data , view should separated).

how can wrap every list item observable or best approach?

for each column, create cellvaluefactory wraps pojo properties in javafx property. example below on fictive person object has string property called name:

tablecolumn<person, string> namecolumn = new tablecolumn<>("name"); namecolumn.setcellvaluefactory(param -> new simplestringproperty(param.getvalue().getname())); 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -