please post the code snippet for the datagrid you are using and I may be able to tell what needs to be done..
This is my code :
<mx:DataGridColumn dataField="tn" headerText="Ticket No" headerStyleName="headerDG"/>
<mx:DataGridColumn dataField="title" width="150" headerText="Ticket Title" headerStyleName="headerDG" itemRenderer="mx.controls.Label"/>
<mx:DataGridColumn dataField="a_body" width="200" itemEditor="mx.controls.Text" headerText="Ticket Body" headerStyleName="headerDG" itemRenderer="mx.controls.Label" />
<mx:DataGridColumn dataField="ticket_create_time" width="300" headerText="Create Time" headerStyleName="headerDG" />
wsObj is my webservice object. The line that I have underlined and highlighted is where the problem occurs. the mysql field in the table is a_body.
Any idea ?
Since you have used Label as item renderer you will get a .. when text width > label width.But here you are not getting it because text width might not be greater than label width.The text in question here is a multiline text.Label will show only single line.And the longest line in your data is also less than the label width.Hence no .. . You can check this by giving a long line in your data and it will show a .. and tooltip(if you are using Label as itemrenderer).
The default item renderer will show the multiline text.So no need to specify any itemRenderer.You might have to set variableRowHeight to true.There is no need to use itemEditor to achieve what you are looking for.One more thing,an item editor will work only if you set the editable property of datagrid and the column where itemeditor is used are set to true.
Hope I answered your question
Hey thanks! that worked ...:)
Though I am just curious, is there any way I can delete new lines in a string on the flex side ? I mean when I receive something like :
I want to strip the string of newlines so that I get "Hi,Some text.Thanks". How can I accomplish that ?
Also, I am using a webservice response to load my datagrid i.e webserviceObj.functionname.lastResult. Is there any way I can count the number of rows in the response so that I can set the rowCount for my datagrid accordingly ? What wld be the best way to do this ?
1 person found this helpful
Use the replace() method in String class to replace the newline characters.
set rowCount = Array(webserviceObj.functionname.lastResult).length,assuming lastResult is an Array.But this can break the layout of components if the response has large number of rows(Assume you have 100 rows in response .Then the datagrid will have 100 rows and that will look weird).So I would rather give a constant rowCount or a height for datagrid and let the scrollbars come in case there are more rows.
okk...thanks mate .. really appreciate your help