Last column won't save if it is in edit mode

Tags: #<Tag:0x00007efc6b893be0>

I inherited a project that uses a couple of handsontables. I was tasked with adding more columns to one of them and noticed that when I save my handsontable via html button click, if the last column still has focus, it doesn’t get read in by my GetData() method.

Here’s my method:

	function GetData() {
		debugger;
		TableData2 = new Array();
		strJSON = "";
		var rowCount2 = hot2.countRows();
		var id = '@reportId';
		for (i = 0; i < rowCount2; i++) {
			var Lot = hot2.getDataAtCell(i, 0);
			var Product = hot2.getDataAtCell(i, 1);
			var Customer = hot2.getDataAtCell(i, 2);
			var Qty = hot2.getDataAtCell(i, 3);

			var Scrap = hot2.getDataAtCell(i, 4);
			var HoldRequired = hot2.getDataAtCell(i, 5);
			var Location = hot2.getDataAtCell(i, 6);
			var Operation = hot2.getDataAtCell(i, 7);
			var Recipe = hot2.getDataAtCell(i, 8);
			var SpecialRecipe = hot2.getDataAtCell(i, 9);

			TableData2[i] = { 'id': id, 'LotId': Lot, 'ProductCode': Product, 'Customer': Customer, 'Qty': Qty, 'Scrap': Scrap, 'HoldRequired': HoldRequired, 'Location': Location, 'Operation': Operation, 'Recipe': Recipe, 'SpecialRecipe': SpecialRecipe };
		}
		return TableData2;
	}

Can you tell me how to resolve this issue?

Hi @phil.n.deblanc1

could you share the code via JSFiddle/CodePen/JSBin demo? I’ll share it with our devs.

OK, I’ve put it all into here: https://jsfiddle.net/j7p2xhu3/1/ but I don’t know how much good it will do since the data is retrieved from a database.

Thank you.

Can you recheck the example, Phil?
I got a syntax error at the beginning and I do not know if the buttons are important for this example but they are returning the reference error.

It works for me. Can you show me what you see? The data for the table comes from the jQuery.extend call and works great, if that’s what you’re wondering about.

Here is what I get

the log (as I think) block the table from rendering. And the below errors are the result of click the button

I am sorry but as the table won’t even display itself there’s not much I can do and there’s definitely a syntax error in the code.

I added some more code, but I think that the problem is that this hot is in an ASP.Net w/ Razor project, so the embedded C# elements are causing problems. Let me see if I can fix those and get back to you.

I’ve made some more changes, but I don’t see how it’s going to work if you don’t have the backend required to get/save data.

Yes, it may be the case.

Have you tried our Save and Load tutorial? It at https://docs.handsontable.com/pro/1.12.0/tutorial-load-and-save.html
Maybe it will come in handy

I’ll take a look. Thank you.

You’re welcome.

I’m here if you’d need anything.