مرجع تخصصی برنامه نویسان

انجمن تخصصی برنامه نویسان فارسی زبان

کاربر سایت

nimaaamin

عضویت از 1394/05/19

Freeze کردن سطرهدر جدول نمایش اطلاعات در صفحه وب در جاوااسکریپت

  • یکشنبه 9 مهر 1396
  • 22:15
تشکر میکنم

سلام دوستان من جدول نمایش داده هام را در جاوااسکریپت به شکل زیر ایجاد میکنم 

$("#gridDefineNewReportDamage tr").remove();                 $("#gridDefineNewReportDamage").append("" +                         "" +                         "" +                         "" +                         "ردیف" +                         "عامل خسارت/قهری" +                         "تاریخ وقوع" +                         "تاریخ ثبت" +                         "محل وقوع" +                         "خسارت" +                     "" +                     "" +                         "" +                         "" +                         "" +                         "" +                         "" +                         "فروردیناردیبهشتخردادتیرمردادشهریورمهرآبانآذردیبهمناسفند" +                         "" +                         "شهرستان" +                         "بخش" +                         "دهستان" +                         "روستا" +                         "بخش خسارت دیده" +                         "موارد خسارت" +                         "
وضعیت موجود" +                         "بیمه" +                         "خسارت" +                     "" +                     "" +                         "" +                         "" +                         "" +                         "" +                                                "" +                         "" +                         "" +                         "" +                         "" +                         "" +                         "" +                         "" +                         "" +                         "سطح کل موجود در شهرستان" +                         "تعداد بهره برداران شهرستان" +                         "میزان کل تولید در شهرستان" +                         "سطح بیمه شده در شهرستان" +                         "تعداد بهره برداران در شهرستان" +                         "مساحت" +                         "میزان محصول" +                         "درصد" +                         "مبلغ خسارت" +                     "");                 flgRefreshbinddata_gridDefineNewReportDamage = true;             }             else {                 $("#gridDefineNewReportDamage").find("tr:gt(2)").remove();             }             $.each(Result.d, function (key, value) {                 $("#gridDefineNewReportDamage").append("" +                     "" +                     "<a  onclick="AttachmentFile(event,'&quot;" "="" +="" "')="" value.no="" value.existattachmentfile="">" +                     "" + value.row + "" +                         "" + value.crisisOperatingLosses_name + "" +                         "" + value.dateReport + "" +                         "" + value.dateReportRegister + "" +                         "" + value.city_name + "" +                         "" + value.part_name + "" +                         "" + value.viliage_name + "" +                         "" + value.subViliage_name + "" +                         "" + value.typeDemage_name + "" +                         "" + value.subtypeDemage_name + "" +                         "" + delimitNumbers(parseFloat(value.currentStatusAreaAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.currentStatusTotalUsesAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.currentstatusAmountProductionAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.areaInsuredAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.totalUsesInsuredAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.areaDamageAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.amountProductionDamageAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.percentDamageAgriculture.replace('/', '.')).toFixed(2)) + "" +                         "" + delimitNumbers(parseFloat(value.costsDamageAgriculture.replace('/', '.')).toFixed(2)) + "" +                     "");                             });

مشکلی که دارم وقتی اطلاعات زیاد می شود باید همانند اکسل هدر جدول freeze بشه(هدر جدول همواره نمایان باشد حتی وقتی با استفاده از نوار لغزنده به سمت پایین میرود) لطفا راهنماییم کنید که چطور میتونم این مشکلم حل کنم

پاسخ های این پرسش

تعداد پاسخ ها : 3 پاسخ
کاربر سایت

سهیل علیزاده

عضویت از 1396/04/09

  • یکشنبه 9 مهر 1396
  • 23:05

لطفا کدهاتون رو با فرمت کد وارد کنید

کاربر سایت

nimaaamin

عضویت از 1394/05/19

  • سه شنبه 11 مهر 1396
  • 21:11
$("#gridDefineNewReportDamage tr").remove();
                $("#gridDefineNewReportDamage").append("<tr class=GridViewHeaderStyle >" +
                        "<th class=noExl></th>" +
                        "<th class=noExl></th>" +
                        "<th class=noExl></th>" +
                        "<th>ردیف</th>" +
                        "<th>عامل خسارت/قهری</th>" +
                        "<th>تاریخ وقوع</th>" +
                        "<th>تاریخ ثبت</th>" +
                        "<th colspan=4>محل وقوع</th>" +
                        "<th colspan=11>خسارت</th>" +
                    "</tr>" +
                    "<tr class=GridViewHeaderStyle>" +
                        "<th class=noExl></th>" +
                        "<th class=noExl></th>" +
                        "<th class=noExl></th>" +
                        "<th></th>" +
                        "<th></th>" +
                        "<th><select id=selfillterMonthRegisterReport  multiple=multiple onchange=txtfilterDefualtMonth_change(this.id) class=noExl style=width:150px;height:80px><option value=1>فروردین</option><option value=2>اردیبهشت</option><option value=3>خرداد</option><option value=4>تیر</option><option value=5>مرداد</option><option value=6>شهریور</option><option value=7>مهر</option><option value=8>آبان</option><option value=9>آذر</option><option value=10>دی</option><option value=11>بهمن</option><option value=12>اسفند</option></select></th>" +
                        "<th></th>" +
                        "<th>شهرستان</th>" +
                        "<th>بخش</th>" +
                        "<th>دهستان</th>" +
                        "<th>روستا</th>" +
                        "<th>بخش خسارت دیده</th>" +
                        "<th>موارد خسارت</th>" +
                        "<th  colspan=2>وضعیت موجود</th>" +
                        "<th colspan=2>بیمه</th>" +
                        "<th colspan=5>خسارت</th>" +
                    "</tr>" +
                    "<tr class=GridViewHeaderStyle>" +
                        "<th class=noExl></th>" +
                        "<th class=noExl></th>" +
                        "<th class=noExl></th>" +
                        "<th></th>" +                        
                        "<th ><select  multiple=multiple class=noExl id=selfiltercrisisOperatingLosses onchange=selfiltercrisisOperatingLosses_change(thi  s.id) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl id=txtfilterDate onchange=txtfilterDate_change(this.id) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl id=txtfilterDateRegister onchange=txtfilterDateRegister_change(this.id) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl id=selfilterCity onchange=selfilterCity_change(this.id) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl id=selfilterpart onchange=selfilterpart_change(this.id) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl id=selfilterviliage onchange=selfilterviliage_change(this.id) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl id=selfiltersubviliage onchange=selfiltersubviliage_change(this.id) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl  id=selfiltercrisisTypeOfDemage onchange=selfiltercrisisTypeOfDemage_change(this.i  d) style=width:150px;height:100px;></select></th>" +
                        "<th ><select multiple=multiple class=noExl  id=selfiltercrisisTypesubDemage onchange=selfiltercrisisTypesubDemage_change(this.  id) style=width:150px;height:100px;></select></th>" +
                        "<th style=width:100px;>سطح کل موجود در شهرستان</th>" +
                        "<th style=width:100px;>تعداد بهره برداران شهرستان</th>" +
                        "<th style=width:100px;>میزان کل تولید در شهرستان</th>" +
                        "<th style=width:100px;>سطح بیمه شده در شهرستان</th>" +
                        "<th style=width:100px;>تعداد بهره برداران در شهرستان</th>" +
                        "<th style=width:100px;>مساحت</th>" +
                        "<th style=width:100px;>میزان محصول</th>" +
                        "<th style=width:100px;>درصد</th>" +
                        "<th style=width:100px;>مبلغ خسارت</th>" +
                    "</tr>");
                flgRefreshbinddata_gridDefineNewReportDamage = true;
            }
            else {
                $("#gridDefineNewReportDamage").find("tr:gt(2)").r  emove();
            }
            $.each(Result.d, function (key, value) {
                $("#gridDefineNewReportDamage").append("<tr class=heighttrtableorginal>" +
                    "<td style=width:10px class=noExl><a " + value.stylesumrow + " onclick=deleteDamageReport('"+value.no+"') ><img src=../Images/deleteico.png ></a> </td>" +
                    "<td style=width:10px class=noExl><a  " + value.stylesumrow + " onclick=editDamageReport(event,'" + value.no + "') ><img src=../Images/editico.png ></a></td>" +
                    "<td style=width:10px class=noExl><a  " + value.ExistAttachmentfile + " onclick=AttachmentFile(event,'" + value.no + "') ><img src=../Images/1441980203_mail-attachment.png ></a></td>" +
                    "<td style=width:30px>" + value.row + "</td>" +
                        "<td style=width:100px;>" + value.crisisOperatingLosses_name + "</td>" +
                        "<td style=width:100px;>" + value.dateReport + "</td>" +
                        "<td style=width:100px;>" + value.dateReportRegister + "</td>" +
                        "<td style=width:100px;>" + value.city_name + "</td>" +
                        "<td style=width:100px;>" + value.part_name + "</td>" +
                        "<td style=width:100px;>" + value.viliage_name + "</td>" +
                        "<td style=width:100px;>" + value.subViliage_name + "</td>" +
                        "<td style=width:100px;>" + value.typeDemage_name + "</td>" +
                        "<td style=width:100px;>" + value.subtypeDemage_name + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.currentStatusAreaA  griculture.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.currentStatusTotal  UsesAgriculture.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.currentstatusAmoun  tProductionAgriculture.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.areaInsuredAgricul  ture.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.totalUsesInsuredAg  riculture.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.areaDamageAgricult  ure.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.amountProductionDa  mageAgriculture.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.percentDamageAgric  ulture.replace('/', '.')).toFixed(2)) + "</td>" +
                        "<td style=width:100px>" + delimitNumbers(parseFloat(value.costsDamageAgricul  ture.replace('/', '.')).toFixed(2)) + "</td>" +
                    "</tr>");
                 
            });

کاربر سایت

nimaaamin

عضویت از 1394/05/19

  • سه شنبه 18 مهر 1396
  • 23:28

کسی نیست کمکم کنه!؟

کاربرانی که از این پست تشکر کرده اند

هیچ کاربری تا کنون از این پست تشکر نکرده است

اگر نیاز به یک مشاور در زمینه طراحی سایت ، برنامه نویسی و بازاریابی الکترونیکی دارید

با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)