how to get multiple values by using ajax in handsontable

172
March 09, 2018, at 01:49 AM

I'm using the handsontable jquery in JSP Spring + Angular JS I success already put data of first row by using ajax. But, my program is ignoring Second, third....... rows

var 
    objectData = [{ 
    	  pno_stock: "3200105009", 
		  pname_stock: "VALVE", 
		  capital_stock: "a", 
		  tracking_no_stock: "SE17", 
		  standard_stock: "SRT", 
		  unit_stock: "SET",   
		  storage_code_stock: "C03", 
		  storage_name_stock: "", 
		  stock_amount_stock: "6", 
		  price_indicator_stock: "M", 
		  client_code_stock: "1244156104", 
		  client_name_stock: "A company"}, 
		  { 
	    	  pno_stock: "3243334802", 
			  pname_stock: "COVER", 
			  capital_stock: "a", 
			  tracking_no_stock: "SE17", 
			  standard_stock: "", 
			  unit_stock: "EA",   
			  storage_code_stock: "C03", 
			  storage_name_stock: "", 
			  stock_amount_stock: "3", 
			  price_indicator_stock: "M", 
			  client_code_stock: "1228182903", 
			  client_name_stock: "B company"} 
    ], 
    container3 = document.getElementById('example'), 
    hot; 
 
  hot = new Handsontable(container3, { 
    data: objectData, 
    contextMenu: true, 
    rowHeaders: true,         
    minSpareRows: 1, 
    columns: [{ 
          data: 'pno_stock'          
      }, { 
          data: 'pname_stock'         
      }, { 
          data: 'capital_stock'         
      }, { 
          data: 'tracking_no_stock'         
      }, { 
          data: 'standard_stock'         
      }, { 
          data: 'unit_stock'         
      }, { 
          data: 'storage_code_stock'         
      }, { 
          data: 'storage_name_stock'         
      }, { 
          data: 'stock_amount_stock'         
      }, { 
          data: 'price_indicator_stock'         
      }, { 
          data: 'client_code_stock'         
      }, { 
          data: 'client_name_stock'         
      }], 
  }); 
   
   
  var sourceRow = hot.getSourceDataAtRow(0),  
 
console.log('* the getSourceDataAtRow:'); 
console.log(sourceRow); 
  
 
					        
					        $(document).ready(function () { // DOM hierarchy constructed. Ready to attach event handlers and run jQuery code etc. 
					            $("#Submit").click(function (e) { 
					                e.preventDefault(); 
					                //var tableData = $("#example").handsontable('sourceRow');					         
					                var formDataJson = JSON.stringify(sourceRow); 
					                alert("before jQuery : " + formDataJson); 
					                jQuery.ajax({ 
					                    type: "POST", 
					                    headers: { 
					                        'Accept': 'application/json', 
					                        'Content-Type': 'application/json; charset=utf-8'					                        	 
					                    }, 
					                    'url': "/yboard/insert1", 
					                    'data':  formDataJson, 
					                    'dataType': 'json', 
					                    'success': function (e) { 
					                    	console.log(formDataJson); 						                         
					                    }, 
					                    'error': function() { 
					            			alert("Loading failed!" +"\n" ); 
					            			console.log(formDataJson);  
					            			 
					            		}, 
					                }); 
					            }); 
					        }); 
 
function showBootstrapModal() { 
  $('.modal').modal({ 
    backdrop: 'static', 
    keyboard: true, 
  }); 
 
  $('.modal').on('hidden.bs.modal', function (e) { 
    console.log("hidden"); 
  }); 
 
  $('.modal').on('shown.bs.modal', function (e) { 
    console.log("shown"); 
    hot.render(); 
  }); 
}; 
 
 
$(document).ready(function () { 
  $('#btn').click(showBootstrapModal); 
}); 
     
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
<form class="form-horizontal" role="form" id="handsontableForm">	 
						    <div id="example"></div> 
						    <INPUT id="Submit" TYPE="SUBMIT" VALUE="Submit" style="margin-top: 50px;"> 
							</form> 
<div style="text-align:left"> 
    <label id="serverResults"></label>

I tried to change variable sourceRow from 'var sourceRow = hot.getSourceDataAtRow(0)' to 'var sourceRow = hot.getSourceData()'

and I checked all normal datas in console screen But, also I got 'Loading failed!', What's problem in this code?

Rent Charter Buses Company
READ ALSO
How to turn extracted href into hyperlink

How to turn extracted href into hyperlink

I'm working on a tagging part on a site similar to FacebookThe idea is that whenever someone types @ in the post area, a drop down menu appears containing all of his friends

156
Uncaught ReferenceError: jQuery is not defined while add async load

Uncaught ReferenceError: jQuery is not defined while add async load

I have changed a lot to get a higher page speed score: 1add js async except jquery

200
How to change value using JQuery?

How to change value using JQuery?

I have got this code

199
NullPointer exception with equals and == [duplicate]

NullPointer exception with equals and == [duplicate]

This question already has an answer here:

202