RishiPandey
RishiPandey

Reputation: 212

Making a column editable of dynamic created table

Friends i have created a dynamic table which expends as data comes i want column Qty to be editable. This is my code for appending data to dynamic table

the cells are appending to "customer2" table on click of tr of "customer1" table.

     $('#custorder1').on('click', 'tr', function()
            {
            var zitemNo=$(this).find('td:first').text();    
            var z1Pkg=$(this).find('td:nth-child(8)').text();

            for(var i=0;i< itemForSale.length;i++)
            {
                var obj = itemForSale[i];

                var vitemNo         = obj["itemNo"];
                var vpkg            = obj["pkg"];
                var vRate           = obj["regPrice"];

                if(zitemNo == vitemNo && z1Pkg == vpkg)
                {

                    var Markup = "<tr><td>"+" "+"</td><td>"+vmobileNo+"</td><td>"+ vitemNo + "</td><td>"+vpkg+"</td><td>"+vRate+"</td><td>"+  +"</td></tr>";
                // $("#custorder2 tbody").append(Markup);   
                    $("#custorder2 tr:last").after(Markup);
                }       
            }   
            });

// This is code for creating table skeleton

     <table class="CSSTableGenerator" id="custorder2">
                    <col width="100">
                    <col width="100">
                    <col width="100">
                    <col width="100">
                    <col width="100">
                    <col width="100">
                        <thead id="headOn">
                        <tr id="head2">
                            <th>
                                Order No.
                            </th>
                            <th>
                                Mobile No.
                            </th>
                            <th>
                                Item No.
                            </th>
                            <th>
                                Pkg
                            </th>
                            <th>
                                Rate
                            </th>
                            <th>
                                Qty
                            </th>
                          </tr>
                        </thead>
                        <tbody>
                    </tbody>
                   </table>

// Help me please.

Upvotes: 1

Views: 123

Answers (1)

RishiPandey
RishiPandey

Reputation: 212

Use contenteditable='true'

var Markup = "<tr><td>" + " " + "</td><td>" + vmobileNo + "</td><td>" + vitemNo + 
             "</td><td>" + vpkg + "</td><td>" + vRate +
             "</td><td contenteditable='true'>"+ +"</td></tr>"; 

Upvotes: 2

Related Questions