如何删除html表中的列索引? [英] How can i remove column index in html's table?

查看:82
本文介绍了如何删除html表中的列索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有1个问题需要你的想法。我有1个报告,有3个参数(从月,月和年)。我的报告仅显示在月份和月份之间。例如:从月份= 4月到月份= 6月份==>我的报告将显示4月和6月。

我使用Javascript与Jquerty隐藏如下:

  //  从1月到月份隐藏 
$ .each($( #product> tbody> tr:gt(0)), function (i ,v){
$ .each($(v).find( td ).slice( 1 ,start), function (i1,v1){
$( v1).css( display none);
});
});
// 隐藏到月份=> Dec
$ .each($( #product> tbody> tr:gt(0 )), function (i,v){
$ .each($(v).find( td)。slice(end, 37 ), function (i1,v1){
$(v1).css( display none);
} );
});



使用此代码后,我的报告显示正确。这意味着它显示在From Month和To Month之间。



但是当我导出到excel时,它仍然会显示12个月。这意味着excel与报表不一样。例如上面的例子:报告显示4月5月6月(正确)但在Excel中,它显示12个月(从1月到12月开始)(不正确)。正确的excel应该显示在4月5月6月(与报告相同的col)。



所以有人知道如何使用javascript或jquery删除html表的col删除未使用的月份?



注意:在我的sql中,它已经有12个月



谢谢

解决方案

.each(


#product> tbody> tr:gt(0)), function (i,v){


。每个(

Hi everyone,

I have 1 problem need your idea. I have 1 report that have 3 parameters ( From Month, To Month and Year). My report will display between From Month and To Month of year only. ex: From Month=Apr and To Month=June==> My report will display Apr May and Jun.
I use Javascript with Jquerty to hide like this:

// For Hide From Jan to From Month
$.each($("#product>tbody>tr:gt(0)"), function (i, v) {
      $.each($(v).find("td").slice(1, start), function (i1, v1) {
          $(v1).css("display", "none");
      });
  });
// For Hide To Month=> Dec
  $.each($("#product>tbody>tr:gt(0)"), function (i, v) {
      $.each($(v).find("td").slice(end, 37), function (i1, v1) {
          $(v1).css("display", "none");
      });
  });


After i used this code, my report display correctly. it means that it displays between From Month and To Month.

But when i export to excel, It still display 12 months. It means that in excel is not the same with report form. like example above: The report displays Apr May Jun ( Correct) but In Excel, it displays 12 months (start from Jan to Dec) ( Incorrect). the correct in excel should be displayed Apr May Jun ( the same col with report).

So Does anybody know how i can remove col of html's table using javascript or jquery to remove unused month?

Note: in my sql, it already has 12 months

Thanks

解决方案

.each(


("#product>tbody>tr:gt(0)"), function (i, v) {


.each(


这篇关于如何删除html表中的列索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆