EasyUI Forum
March 28, 2024, 10:21:48 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to give class name to datagrid column fields  (Read 5635 times)
kush
Newbie
*
Posts: 29


View Profile Email
« on: November 01, 2014, 04:25:51 AM »

I have a requirement of loading dynamic columns on click of a left arrow.For that i am looping over "table th" array  with class name.And have given Class name to th fields from markup.

<th class="monthTd" field="jan 14" width="80">Jan 14</th>
<th class="monthTd" field="Feb 14" width="80">Feb 14</th>
<th class="monthTd" field="Mar 14"  width="80">Mar 14</th>
<th class="monthTd" field="Apr 14" width="80">Apr 14</th>
<th class="monthTd" field="May 14" width="80">May 14</th>
<th class="monthTd" field="Jun 14" width="80">Jun 14</th>
<th class="monthTd" field="Jul 14"  width="80">Jul 14</th>
<th class="monthTd" field="Aug 14" width="80">Aug 14</th>
<th class="monthTd" field="Sep 14" width="80">Sep 14</th>
<th class="monthTd" field="Oct 14"  width="80">Oct 14</th>
<th class="monthTd" field="Nov 14" width="80">Nov 14</th>
<th class="monthTd" field="Dec 14" width="80">Dec 14</th>

$('th.monthTd').each(function(m) {}   ----Looping th array with class name..
But the problem is on click of right arrow months will move to next months with columns.
for that i need to everytime call datagrid with modified columns array.
$('#dg').edatagrid({
             columns:[new set of th fields],
         });
For first time its dynamically changing column headers because the .monthTd is found in markup.
Next time when i filled dynamically from datagrid classname become empty.

So i want to set class name in my columns array.pls look into attachment nd do reply.

[ { title="Apr 2014", field="Apr 2014", width=80},{ title="Apr 2014", field="Apr 2014", width=80}]
Logged
kush
Newbie
*
Posts: 29


View Profile Email
« Reply #1 on: November 01, 2014, 09:00:48 PM »

Please let me know if i can give class name to columns fields from javascript.Becuase Jeasyui handling my markup tags to display none , and its tags dynamically to datagrid without my class name.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: November 02, 2014, 11:41:15 PM »

Why do you want to set a class name to the columns? To create datagrid with specified columns, just define the 'columns' property.
Code:
$('#dg').edatagrid({
  columns:[[
    {...}
  ]]
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!