如何将列放在特定行中。 [英] How I Can Put Column In Specific Row .
问题描述
< input type =textid =input1class =form-control/>
当我输入此输入行中的某些值时,会根据该值生成。
我还有两个下拉类别和项目。
当我选择特定类别时,然后根据我选择的类别填充项目。
项目有一些属性,这些属性附加在表格的头部。
like
table thead的搭配喜欢
sr项目品牌unitprice laserjet(这是物业)光学(这是物业)
现在我无法将列放在特定的行中..
可以任何人告诉这个..
这里是代码..
$(#input1)。keyup(function(){
$('。 addedRow')。remove(); //删除附加行中的所有元素
var categoryId = $(#categoryName)。val();
// alert(categoryId);
$ .ajax({
类型:POST,
url:categoryProperty .php,
数据:categoryId =+ categoryId,
dataType:json,
成功:函数(数据)< br $>
{
$(#table1 tbody)。html();
$(#table1 thead)。append( Sr No.Item NameBrandUnit Price);
var totalRowColumn = 5 + parseInt(data.length);
//alert(data.length);
for(var i = 0; I< data.length;> {
// alert(你好);
$(#table1 thead tr)。append(''+ data [i] .property_name +'') ;
}
$(#table1 thead tr)。append('Description');
var count = 1;
for(var totalRow = 0; totalRow< $(#input1)。val(); totalRow ++)
{
$(#table1 tbody)。append();
var apend = $('');
for(var totalColumn = 0; totalColumn< totalRowColumn; totalColumn ++)
{
apend .append( '' + +计数);
if(totalColumn == 0)
{
count = count + 1;
// alert(count);
$(#table1 tbody .tr)。append(''+ count +'');
}
else if(totalColumn == 1)
{
$(#table1 tbody tr)。append(''+ $(#itemName option:selected)。text()+'');
}
else if(totalColumn == 2)
{
$(#table1 tbody tr)。append('< select>< option> Brand1< / option>< option> brand2< / option>< option> brand3< / option>< / select>' );
}
else
{
$(#table1 tbody tr )。append('< input type = text />');
}
}
count ++;
}
//计数++;
},
错误:function(){
}
});
})
<input type="text" id="input1" class="form-control"/>
when i enter some values in this input rows are generated according to the value .
also i have two drop down for category and items .
when i select specific category then items are populated according to category i selected .
items has some properties and these properties append within the head of table.
like
table thead looks like
sr item brand unitprice laserjet(this is property) optical(this is property)
now i am not able to put column in specific row ..
can any one tell about this..
here is the code..
$("#input1").keyup(function () {
$('.appendedRow').remove(); //remove all the elements that are in appended row
var categoryId=$("#categoryName").val();
// alert(categoryId);
$.ajax({
type:"POST",
url:"categoryProperty.php",
data:"categoryId="+categoryId,
dataType:"json",
success:function(data)
{
$("#table1 tbody").html("");
$("#table1 thead").append("Sr No.Item NameBrandUnit Price");
var totalRowColumn = 5 + parseInt(data.length);
//alert(data.length);
for(var i =0; i<data.length;> {
//alert("hello");
$("#table1 thead tr").append(''+data[i].property_name+'');
}
$("#table1 thead tr").append('Description');
var count = 1;
for(var totalRow = 0; totalRow< $("#input1").val(); totalRow++)
{
$("#table1 tbody").append("");
var apend = $('');
for(var totalColumn = 0; totalColumn < totalRowColumn ; totalColumn++ )
{
apend.append(''+count+'');
if(totalColumn == 0 )
{
count = count + 1;
// alert(count);
$("#table1 tbody .tr").append(''+count+'');
}
else if(totalColumn == 1)
{
$("#table1 tbody tr").append(''+$("#itemName option:selected").text()+'');
}
else if(totalColumn == 2)
{
$("#table1 tbody tr ").append('<select><option>Brand1</option><option>brand2</option><option>brand3</option></select>');
}
else
{
$("#table1 tbody tr ").append('<input type=text/>');
}
}
count++;
}
// count++;
},
error:function(){
}
});
})
推荐答案
(#input1)。keyup(function(){
("#input1").keyup(function () {
('。attachedRow')。删除(); //删除附加行中的所有元素
var categoryId =
('.appendedRow').remove(); //remove all the elements that are in appended row
var categoryId=
(#categoryName)。val();
// alert(categoryId);
("#categoryName").val();
// alert(categoryId);
这篇关于如何将列放在特定行中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!