EasyUI Forum
September 14, 2025, 12:59:13 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: How to make datagrid cell text wrapped?  (Read 18476 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« 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:
« Last Edit: March 10, 2015, 10:33:32 PM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #1 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 Cheesy
« Last Edit: March 10, 2015, 10:15:33 PM by Opan Mustopah » Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #2 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:
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #3 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.

Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #4 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  Wink
http://jsfiddle.net/aswzen/hkz1gpwj/1/
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #5 on: March 11, 2015, 08:34:31 AM »

please try this updated fiddle

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

hope it like what you want.

Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #6 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 Cheesy
makasih mas bro
« Last Edit: March 11, 2015, 06:45:25 PM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #7 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

 Grin
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #8 on: March 11, 2015, 08:08:10 PM »

hahah jadi kaya orang bloon saya, padahal udah disediain methodnya
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
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!