EasyUI Forum
April 27, 2024, 09:29:03 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: custom view td width calculation  (Read 9719 times)
bobee
Newbie
*
Posts: 5


View Profile
« on: September 30, 2012, 10:20:45 PM »

hi guys,
first of all thx for this great plugin Cheesy

can u guys help me how to make td width in custom view so that it can match the header' width
heres my piece o code

var custview = $.extend({}, $.fn.datagrid.defaults.view, {  
    renderRow: function(target, fields, frozen, rowIndex, rowData){  
        var cc = [];  
//        cc.push("<div style='overflow-x:auto;'>");
        if(frozen){
            for(var i=0; i<fields.length; i++){  
              var copts = $(target).datagrid('getColumnOption', fields);  
              cc.push('<td field="' + copts.field + '" style="width:160px;text-align:center">'+rowData[fields]+'</td>');  
            }
        }
        if (!frozen){  
//            
            for(i=0; i<fields.length; i++){  
                copts = $(target).datagrid('getColumnOption', fields);  
                cc.push('<td field="' + copts.field + '" style="width:100px; border-right:1px dotted #ccc">'+rowData[fields]+'</td>');  
            }  
            cc.push('</div>');  
        }  
//        cc.push("</div>");
        return cc.join('');  
    }
});

additional note -> i define style:width:100px to match the header width .. but :/ .... doesnt work
* did further investigation ... seemed that custom view' fitColumns-> true by default ...  (how to turn this thing off lol )

thx Cheesy
« Last Edit: September 30, 2012, 10:40:49 PM by bobee » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 01, 2012, 04:03:28 AM »

Please refer to the renderRow implementation of default view.

http://www.jeasyui.com/extension/downloads/jquery-easyui-datagridview.zip
Logged
bobee
Newbie
*
Posts: 5


View Profile
« Reply #2 on: October 02, 2012, 04:01:21 AM »

hahaha Cheesy this is what i needed Cheesy thx mate
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!