EasyUI Forum
May 17, 2024, 05:01:35 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: Datagrid problem with lines, that have newline and carriage return characters  (Read 10084 times)
jmansur
Newbie
*
Posts: 31


View Profile
« on: November 16, 2015, 06:16:20 AM »

Hello.
I have a problem with a datagrid .
I have a data entry screen with a textbox , then each data is displayed in a datagrid .
But when in the textbox text data are loaded with newline and carriage return, in the datagrid records are not displayed .
You have to configure something ?

Best Regards
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: November 16, 2015, 06:29:18 PM »

Please describe your question in a bit more detail, or provide an example to demonstrate your issue.
Logged
jmansur
Newbie
*
Posts: 31


View Profile
« Reply #2 on: November 17, 2015, 05:47:44 AM »

I have this datagrid.

      // ********************************************************************
      // Defino el datagrid para recuperar todas las informaciones de trabajo
      // ********************************************************************
      $('#dgIT').datagrid({
         url:'Ajax/get_IT.asp',
         width: '100%',
         height: '100%',
         autoRowHeight:true,
         autoSizeColumn:true,
         toolbar: '#tbDgIT',         // Establece cual es el toolbar del grid
         collapsible:false,
         fitColumns:true,
         loadMsg: 'Procesando: Aguarde un momento.',
         striped:true,
         multiSort:false            // habilita o sehabilita el multisort del grid
      });

this are the fields that I show in the datagrid.
   FechaCarga
   UsuarioCarga
   It --> (this text can contain multiple lines)


If the "It" field contain the  newline character and carriage return character, any record are load into the grid.

And this is the ajax


<!-- #include virtual="Apl/SMR/Clases/ClassSMRIncidentes.asp" -->
<!-- #include virtual="Global/Clases/ClassDbConnect.asp" -->
<!-- #include virtual="Global/Clases/ClassAdoDb.asp" -->
<%
response.Charset="ISO-8859-1"
Dim oSF
Set oSF   = New SMRIncidentes

' Vinieron los filtros
f_NroIncidente      = Request("NroInc")
f_ItId = request("ItId")

Cantidad = oSF.getIT( f_NroIncidente, f_ItId )
rsa  = oSF.rsRowsSet

sRow = "["
For i = 0 To Cantidad - 1
   sRow = sRow & "{"
   sRow = sRow & "'NroIncidente':'" & rsa(i).Item("NroIncidente") & "',"
   sRow = sRow & "'ItId':'" & rsa(i).Item("ItId") & "',"
   sRow = sRow & "'FechaCarga':'" & rsa(i).Item("FechaCarga") & "',"
   sRow = sRow & "'It':'" & rsa(i).Item("It") & "',"
   sRow = sRow & "'DescAdjunto1':'" & rsa(i).Item("DescAdjunto1") & "',"   
   sRow = sRow & "'DescAdjunto2':'" & rsa(i).Item("DescAdjunto2") & "',"   
   sRow = sRow & "'DescAdjunto3':'" & rsa(i).Item("DescAdjunto3") & "',"      
   sRow = sRow & "'ExtAdj1':'" & rsa(i).Item("ExtAdj1") & "',"   
   sRow = sRow & "'ExtAdj2':'" & rsa(i).Item("ExtAdj2") & "',"   
   sRow = sRow & "'ExtAdj3':'" & rsa(i).Item("ExtAdj3") & "',"      
   sRow = sRow & "'UsuarioCarga':'" & rsa(i).Item("UsuarioCarga") & "',"      
   sRow = sRow & "'OrgCodigo':'" & rsa(i).Item("OrgCodigo") & "' "      
   sRow = sRow & "}"
   if i < Cantidad - 1 then
      sRow = sRow & ","
   end if   
Next
sRow = sRow & "]"
sRow = Replace(sRow,Chr(39),Chr(34))
sRow = Replace(sRow,Chr(10),Chr(32)) // Replace newline with space to work datagrid
sRow = Replace(sRow,Chr(13),Chr(32)) // Replace carriage return with space to work datagrid
response.write(sRow)
%>
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: November 17, 2015, 06:24:24 PM »

If you want to display multiline text on a cell, please define the 'formatter' function to convert the CR+LF to <br>.
Code:
var data = [
{FechaCarga:'FechaCarga1',UsuarioCarga:'UsuarioCarga1',It:'It\r\nIt2\r\nIt3'},
{FechaCarga:'FechaCarga2',UsuarioCarga:'UsuarioCarga2',It:'It\r\nIt2\r\nIt3'},
{FechaCarga:'FechaCarga3',UsuarioCarga:'UsuarioCarga3',It:'It\r\nIt2\r\nIt3'}
];

$(function(){
$('#dg').datagrid({
data: data,
columns:[[
{field:'FechaCarga',title:'FechaCarga',width:100},
{field:'UsuarioCarga',title:'UsuarioCarga',width:100},
{field:'It',title:'It',width:200,
formatter: function(value){
return value.replace(/\r\n/g, '<br>');
}
}
]]
})
})
Logged
jmansur
Newbie
*
Posts: 31


View Profile
« Reply #4 on: November 18, 2015, 05:50:59 AM »

thankssssssssssssssssssssssssss
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!