Просмотр полной версии : добавление элементов в datagrig
hromoyDron
07.06.2009, 15:21
можно ли в datagrid добавить каринку или кнопку?
Да, см. DataGridColumn.cellRenderer
hromoyDron
08.06.2009, 01:20
А можно поподробней с кодом, если не трудно. Примеров куча но все они немного не о том.
в хелпе есть пример с картинкой
hromoyDron
08.06.2009, 01:54
спс, посмотрю
breebree
09.06.2009, 14:42
меня тоже этот вопрос интересует, смотрел в хелпе но не нашёл, может копипастнете?
hromoyDron
11.06.2009, 13:36
реально, там нету примера,есть только на комбо и чек бокс, кто видел и знает киньте код плз
Methods to implement for the CellRenderer API
You must write a class with the following methods so that the List, DataGrid, Tree, or Menu component can communicate with the cell.
CellRenderer.getPreferredHeight()
Returns the preferred height of a cell.
CellRenderer.getPreferredWidth()
The preferred width of a cell.
CellRenderer.setSize()
Sets the width and height of a cell.
CellRenderer.setValue()
Sets the content to be displayed in the cell.
Methods provided by the CellRenderer API
The List, DataGrid, Tree, and Menu components give the following methods to the cell when it is created within the component. You do not need to implement these methods.
CellRenderer.getCellIndex()
Returns an object with two fields, columnIndex and itemIndex, that indicate the position of the cell.
CellRenderer.getDataLabel()
Returns a string containing the name of the cell renderer's data field.
Properties provided by the CellRenderer API
The List, DataGrid, Tree, and Menu component give the following properties to the cell when it is created within the component. You do not need to implement these properties.
CellRenderer.listOwner
A reference to the List component that contains the cell.
CellRenderer.owner
A reference to the row that contains the cell.
Более подробное описание ищите в хелпе оп запросу CellRenderer. Вот сделал пример именно по вашему случаю, если что непонятно - спрашивайте, но сначала прочтите хелп
Kuruki, а почему при наведении картинка моргает?
Вроде загружается один раз)..там перерисовка какая-то идёт?
hromoyDron
12.06.2009, 13:37
Kuruki, спасибо большое, без вас бы не разобрался.
Тоже интересует вопрос, почему картинка моргает, нельзя ли этого збежать, в visual studio есть такое свойство, как doublebuffering для уличшение отображения динамической графики, нет ли такого во флеше?
Ну да, при каждом мышином событии (и не только наверное) обновляются данные элемента. В моем случае картинка грузится заново и на это уходит немного времени... Нужно сохранять текущее значение данных элемента и сравнивать с обновленными и если равны, то не загружать заново картинку. Думаю сами с этим справитесь... Кстати я там ошибочку допустил
public function setValue(str:String, item:Object, sel:Boolean) : Void
{
if (item != undefined)
{
image._visible = true;
imageLoader.loadClip(item[getDataLabel()], image);
}
image._visible = false;
}
В блоке if забыл return добавить, правда это не повлияло ни на что, т.к после загрузки картинки все свойства клипа-контейнера сбрасывались...
hromoyDron
13.06.2009, 17:47
да, справлюсь, спасибо
Работает на vBulletin ® версия 3.7.3. Copyright ©2000-2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Copyright © 1999-2008 Flasher.ru. All rights reserved.