[英]How do I get Jquery plugin Grider to recalculate the grid when I AJAX change a cell?
I have a great working grid, dynamically populated from my database, powered by Grider, but when I AJAX change a grid value via document.getElemtnById, the cell value in the grid changes, but Grider does not recalculate using that value like it does when you enter your own value. 我有一个很好的工作网格,它是由Grider支持的,是从数据库中动态填充的,但是当我AJAX通过document.getElemtnById更改网格值时,网格中的单元格值会更改,但是Grider不会像使用该值那样重新计算您输入自己的值。
How can I make Gridr recalculate the grid once my document.getElementById AJAX updates the value of a cell? 一旦我的document.getElementById AJAX更新了单元格的值,如何使Gridr重新计算网格?
Gridr: https://github.com/boriscy/grider/ 网格器: https : //github.com/boriscy/grider/
for ($num = 0; $num<=5; $num++){
print "<tr>
<td style=\"display:none\"></td>
<td>
<select name=\"det[$num][item]\" onChange=\"getitemprice(this.value,$num);\">
$item_select
</select>
</td>
<td>
<input name=\"det[$num][price]\" id=\"price_$num\" type=\"text\" class=\"num\" value=\"10\" />
</td>
<td>
<input name=\"det[$num][quantity]\" type=\"text\" class=\"num\" value=\"1\" />
</td>
<td>
<input name=\"det[$num][discount]\" type=\"text\" class=\"num\" value=\"0\" />
</td>
<td style=\"display:none\"></td>
<td class=\"num\">
</td>
</tr>
";
} }
$(document).ready(function(){
$('#table1').grider({countRow: true, countRowAdd: true});
}); });
i ended up just using: 我最终只是使用:
document.getElementById('price_' + row).value = 200;
$('#price_' + row).trigger('change');
grider needed a trigger to calculate everything again, so I just made a trigger and it fired grider! grider需要一个触发器来再次计算所有内容,所以我刚做了一个触发器,就触发了grider!
done. 完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.