ce icon indicating copy to clipboard operation
ce copied to clipboard

how to update cell with proogram with pro version?

Open benci042 opened this issue 4 years ago • 9 comments

Hi Paul I'm using pro version, special cell can be using init data to build jexcel. like this https://jexcel.net/v5/cases/payment-calculator

and now i has new issule ,how to change it by programmatically? i can using getcells return it . and got error msg "cellName is not defined" when i using setcell .like this table.setCells('D1',object) . thanks.

benci042 avatar Sep 19 '20 04:09 benci042

would you like to change the value?

table.setValue('D1', 'newvalue')

pphod avatar Sep 20 '20 09:09 pphod

Thanks for your response , I mean how to change cell type by programmatically. for example ,i need to change "D1" with dropdown with existing table.

benci042 avatar Sep 20 '20 15:09 benci042

Sorry, we are going to include a fix for the method. Meanwhile, this would be the best way to change the object properties.

Changing for type text: table.options.cells['D1'].type = 'text';

Changing for type dropdown: table.options.cells['D1'].type = 'dropdown'; table.options.cells['D1'].source = ['Apples','Pears']; // add here the options

Etc.

pphod avatar Sep 20 '20 15:09 pphod

Noted with thanks.

benci042 avatar Sep 20 '20 15:09 benci042

sorry to interrupt you , when i try put table.options.cells['D1'].type ='text'; I got error message, can't read prperty 'type' of undefined .

benci042 avatar Sep 20 '20 15:09 benci042

If you are setting a new one you should define the whole property: table.options.cells['D1'] = { type:'text' } table.options.cells['D1'] = { type:'dropdown', source:['Apple','Pears'] };

pphod avatar Sep 20 '20 15:09 pphod

big thanks.

benci042 avatar Sep 20 '20 15:09 benci042

image image it's working now . and has little problem. The cell not has dropdown symbol . FYI...

benci042 avatar Sep 20 '20 16:09 benci042

We will make sure to include a method to do that automatically, for now: table.records[0][0].element.classList.add('jexcel_dropdown'); // 0,0 means A1 where y,x table.records[0][3].element.classList.add('jexcel_dropdown'); // 0,3 means D1 where y,x table.records[1][4].element.classList.add('jexcel_dropdown'); // 1,4 means E2 where y,x

Regards,

pphod avatar Sep 20 '20 17:09 pphod