0

I have created objects, and then I need to store those data into array.

Using this function I create Items. Each and every Items I need to save into array.

function appendItemforPurchaseOrder() {
    debugger

    var rowNumber = parseInt($(".itemmapContainer").attr("data-rownumber"));

    rowNumber = isNaN(rowNumber) ? 1 : rowNumber + 1;

    var addNewItemDetailHtml = "<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12 itemmapWrapper custom-paaddingnone'\
                               id='itemmapWrapper" + rowNumber + "' data-rowNumber='" + rowNumber + "' >";

    addNewItemDetailHtml += "<div class='col-lg-10 col-md-10 col-sm-10 col-xs-10 custom-paaddingnone form-group'>\
                                    <div class='col-lg-1 col-md-1 col-sm-1 col-xs-1 itemclass custom-paaddingnone text-center'>" + rowNumber + "\
                                    </div>\
                                    <div class='col-lg-11 col-md-11 col-sm-11 col-xs-11 custom-paaddingnone'>\
                                        <div class='col-lg-12 col-md-12 col-sm-12 col-xs-12 custom-paaddingnone form-group'>\
                                            <div class='col-lg-3 col-md-3 col-sm-3 col-xs-3 custom-paaddingleft' onChange='getItemCode(" + rowNumber + ")'>\
                                                <select class='form-control' id = 'itemid"+ rowNumber + "' ></select>\
                                            </div >\
                                        </div>\
                                    </div>\
                                </div >";

    addNewItemDetailHtml += "<div class='col-lg-2 col-md-2 col-sm-2 col-xs-2 form-group'>\
                                 <div class='col-lg-10 col-md-10 col-sm-10 col-xs-10'>\
                                        <input type='text' class='form-control text-right' id='totalamount"+ rowNumber + "' disabled>\
                                </div>\
                                <div class='col-lg-2 col-md-2 col-sm-2 col-xs-2'>\
                                        <span class='glyphicon glyphicon-trash removeBtn' onclick = 'removeItemDetail(this, " + rowNumber + ")' ></span >\
                                </div>\
                            </div > ";


    addNewItemDetailHtml += "</div>";

    addNewItemDetailHtml += "</div>";

    $(".itemmapContainer").attr("data-rownumber", rowNumber);
    $(".itemmapContainer").append(addNewItemDetailHtml);
    intialize_itemDropDown(rowNumber);
    intialize_Data(rowNumber);
}

There are some more other objects are available but if anyone can resolve this with these objects that would be great.

4
  • 1
    So what is the error? What do you expect to happen or what happening Commented Nov 8, 2019 at 6:40
  • There are no errors, in order to save this item data into my sql-db I need to pass these data into a array. I need to know how. Commented Nov 8, 2019 at 6:50
  • 1
    You can use UserDefinedTable to pass multiple records, Create Stored Procedure and take userdefinedtable as parameter Commented Nov 8, 2019 at 6:51
  • 1
    Generally you do not create or retreive data on the client side, beyond what the user inputs. And of course the odd Asynchronous thing. You retreive/create it on the Server side, post it as part of the html, add some JS to make it look nice on the client, then process the postback. Wich then of course has/recreates the data, because it was the one that generated/wrote it in the first place. Of course without know what this data represents and how it relates to your DB, we can not really tell for certain. Commented Nov 8, 2019 at 6:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.