Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste source #31

Closed
felixvandal opened this issue Sep 6, 2017 · 24 comments
Closed

Paste source #31

felixvandal opened this issue Sep 6, 2017 · 24 comments

Comments

@felixvandal
Copy link

Hello Paul
When you paste something coming from an excel, a new line is added
When you paste something coming from something else, no new line is added
I have teste with a text file, a word file and a javascript.
One coming from notepad ++, one from word and one from netbeans
it seems that only data coming from excel add a new line

@pphod
Copy link
Contributor

pphod commented Sep 6, 2017

If you copy from excel and paste on notepad for example, you will see you will have a new line on notepad. This is a natural behavior form excel that includes a new line on your clipboard on copying cells. And, because of that, we have a new line on jExcel.

@pphod pphod closed this as completed Sep 6, 2017
@felixvandal
Copy link
Author

aaaa ok!
so if i want a new line after i paste data i should add it myself, got it.
i thought it was a behavior of jExcel

@pphod
Copy link
Contributor

pphod commented Sep 7, 2017

Hi Felix, there is an option might be useful. Update from the branch 1.3.0

There is a feature called minSpareRows, after the paste you can always have X blank rows.

@felixvandal
Copy link
Author

i will check it out
eventually, will there be a way to undo and redo copy paste?
thank you for your time

@felixvandal
Copy link
Author

the branch is not stable for my code
first of all the table keep adding row because of the onchange i think
second, i use jExcel to populate a table of tarification and the table is not fully loaded
i will keep using the master

@pphod
Copy link
Contributor

pphod commented Sep 7, 2017

The copy/paste undo on copy and paste is fully working on my tests. About the compatibility can you share you example on fiddle. The branch should be merged soon with the master after full tests. I have not found any exception yet and should be fully compatible. About adding a new row, you can block that by defining not allowed to add new row. Can you share you example and point any problems?

@felixvandal
Copy link
Author

hard for me to tell you what is wrong when so many things happen at the same time
the page keep refreashing and i dont have any control on what is going on
i will run some test and come back to you
all i know is when i disable the onchange event everything is ok (only test i did so far)

@felixvandal
Copy link
Author

for some reason a onchange event is raised for each cell (even when reloading the page, so no data)
my onchange do an ajax call to fetch some data in my database when one of the column is unselected
the ajax then go and getData from the table.
i create an array with the data retrieve from the database.
i splice the array in the array produce from the getData function.
Finally, i setData with the array create from getData
on a final note, i add the class readonly to all item containing the class c10 since its a total column for the row
its basically what my onchange do. i will try playing with it to find if i can do this in a better way
i hope i gave you enough details

@pphod
Copy link
Contributor

pphod commented Sep 7, 2017

I have a new update might be more compatible with you have done.
http://jsfiddle.net/paulhodel/0dyms2b9/

@pphod
Copy link
Contributor

pphod commented Sep 7, 2017

It is published as 1.3.0

@felixvandal
Copy link
Author

I will test it and let you know how it went

@felixvandal
Copy link
Author

it kinda work
let me rephrase
with minSpareRows:1, when the paste is from another source than excel, a line is added
still with the same min spare rows, when i paste from an excel source there is 2 lines added
jExcel add the data of the paste row, than do a onchange event on the first line added that result in a third line added
i would like to give freedom of choice to the users to where they are going to get the data
the same result happen when i copy more than one row from an excel

also, i was reaffecting the value of a currency cell onchange
since i get the new code, i get a Reach max query when i use the fellowing code

$('#wrapperDataGridContent').jexcel("setValue", "9-" + row, unitCost.toFixed(2) + "$", true);

i checked and this trigger a very huge amount of onchange event, like over 500
i did that because i do not like the way jQuery Mask Plugin work (for so many reasons)
do you have an alternative for a currency mask?

thank you again for your time

@pphod
Copy link
Contributor

pphod commented Sep 7, 2017

The problem is: the setValue trigger a change event in the new version as should be. If you call a setValue inside a onchange handler you will trigger a loop.

You have 3 alternatives:

  1. integrate another mask component using this example:
    http://www.bossanova.uk/jexcel/integrating-a-third-party-plugin-into-your-spreadsheet

  2. Call another method to change the value of your cell. This will keep history for undo/redo.
    $(main).jexcel('updateCell', { cell:yourcell, newValue:'asdf', oldValue:'asdf' });

  3. Considering it is a text column, you can manually change the data by:
    $.fn.jexcel.defaults[id].data[y][x] = yourvalue;
    $('yourtable').find('#'+x+'-'+y).html(yournewvalue);

@felixvandal
Copy link
Author

i will check this first thing in the morning tomorrow
as always, thank you for your time

@ashraftalib
Copy link

ashraftalib commented Sep 8, 2017

@paulhodel Issue is while pasting from MS excel or Google spreadsheet cell data to jexcel cell.
Data have some break lines in data-content. In Jexcel while pasting it is making extra new column for every breakline and is putting data into new columns with breaked data. But it should have to be in one single cell same as in Google Sheet or MS. I am attaching two screenshots :
1-one is source from Google Spreadsheet or MS Excel.
2-other one is after pasting into jexcel cell.
1
2

Please help me thank you very much.

@felixvandal
Copy link
Author

Hello again Paul
the fix offer for the mask work very well
looking down jexcel.js i found that i could force a value with the updateCell to pass over cell with readonly property
if i can suggest something, the documentation could use a polish
you can't assume everyone will be digging in the js to find that jexcel can offer

@pphod
Copy link
Contributor

pphod commented Sep 8, 2017 via email

@pphod
Copy link
Contributor

pphod commented Sep 8, 2017 via email

@felixvandal
Copy link
Author

a ok! i did not saw that feature before. thats why i was asking

@pphod
Copy link
Contributor

pphod commented Dec 20, 2018 via email

@PragnaBrahmbhatt
Copy link

@paulhodel Thanks for your instant support.
I need to display excel like UI. So this plugin is excellent but want to display so many fields like in excel. And inside that dynamic data will be loaded.
Please check the screenshot.
excel

@pphod
Copy link
Contributor

pphod commented Dec 20, 2018 via email

@PragnaBrahmbhatt
Copy link

Thank You. Its working.
Is there any function for table horizontal overflow.
tableHeight:'450px',
tableOverflow:true,
By using this overflow-y will be scroll but for horizontal scroll Is there any function??

@PragnaBrahmbhatt
Copy link

@paulhodel
I added below line in jquery.jexcel.js at line number 1370 and now horizontal scroll works fine.
$(tbody).parent().parent().css('overflow-x', 'scroll');

I added this here so it can help other.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants