java - JavaFX- Edit the cell value at a dynamic TableView? -


is possible edit cell vale @ dynamic tableview (dynamic rows , dynamic columns)?

all found on internet editable textfileds on cells.
want edit value on table , update list new data.

i'm using intellij idea 13.1.4 , javafx scene builder 2.0 , newest javafx version.

thanks help...

here code, create dynamic rows , columns:

public list<string[]> jdata = new linkedlist<>(); //here data private tableview<string[]> sourcetable; private observablelist<string[]> srcdata; . . .  int clms;      public void showtable(convert cnv) {         clms = cnv.getcolums(); //number of columns          (int = 0; < clms; i++) {             tablecolumn<string[], string> firstnamecol = new tablecolumn<>("\tc"+(i+1)+" \t");             firstnamecol.setminwidth(20);             int index = ;             firstnamecol.setcellvaluefactory(celldata -> {                 string[] rowdata = celldata.getvalue();                 if (index >= rowdata.length) {                     return new readonlystringwrapper("");                 } else {                     string cellvalue = rowdata[index];                     return new readonlystringwrapper(cellvalue);                 }             });             sourcetable.getcolumns().add(firstnamecol);         }         srcdata = fxcollections.observablelist(jdata);         sourcetable.getitems().addall(srcdata);     } 

just

firstnamecol.setcellfactory(textfieldtablecell.fortablecolumn()); firstnamecol.setoneditcommit(event -> {     string[] row = event.getrowvalue();     row[index] = event.getnewvalue(); }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -