EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: aswzen on March 10, 2015, 08:44:57 PM



Title: How to make datagrid cell text wrapped?
Post by: aswzen on March 10, 2015, 08:44:57 PM
Hi,

i have some data that has a very long text,
how to make that text wrapped in some size in datagrid cell?

thanks


sample:
(http://oi58.tinypic.com/nzkajp.jpg)


Title: Re: How to make datagrid cell text wrapped?
Post by: Opan Mustopah on March 10, 2015, 10:12:39 PM
did you already try using formatter?

Code:
formatter: function(value,row,index){
  // limit length with what you want
  if (row.str.length > 50){
    return row.str.substring(0,49);
  }
}

hope it helps :D


Title: Re: How to make datagrid cell text wrapped?
Post by: aswzen on March 10, 2015, 10:32:14 PM
i don't want to substring it, i just want a full text in wrapped condition.

sample:
(http://oi58.tinypic.com/nzkajp.jpg)


Title: Re: How to make datagrid cell text wrapped?
Post by: Opan Mustopah on March 11, 2015, 01:25:14 AM
i think this property 'autoRowHeight' should be help you.

Code:
Defines if set the row height based on the contents of that row. 

after i read the description, i think this would help you.



Title: Re: How to make datagrid cell text wrapped?
Post by: aswzen on March 11, 2015, 05:59:11 AM
totally not working

here fiddle result with 'autoRowHeight' : true, and for the sandbox if you want to help me on  ;)
http://jsfiddle.net/aswzen/hkz1gpwj/1/


Title: Re: How to make datagrid cell text wrapped?
Post by: Opan Mustopah on March 11, 2015, 08:34:31 AM
please try this updated fiddle

http://jsfiddle.net/hkz1gpwj/2/

hope it like what you want.



Title: Re: How to make datagrid cell text wrapped?
Post by: aswzen on March 11, 2015, 06:41:24 PM
wow ..amazing ..
but you achieve it manually with
Code:
$('.' + attr.cellClass).each(function(){
         var style = $(this).attr('style');
        $(this).attr('style',style+' white-space: pre-wrap;white-space: -moz-pre-wrap;');
   
      });
in onloadsuccess..i have to display 500 data in 45 column at once and it will eat huge memory..

but thankyou :D
makasih mas bro


Title: Re: How to make datagrid cell text wrapped?
Post by: aswzen on March 11, 2015, 06:53:08 PM
hahaha
i found in documentation

nowrap    boolean    True to display data in one line. Set to true can improve loading performance.    true

 ;D


Title: Re: How to make datagrid cell text wrapped?
Post by: Opan Mustopah on March 11, 2015, 08:08:10 PM
hahah jadi kaya orang bloon saya, padahal udah disediain methodnya