LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLSD& value, EAddPosition pos, void* userdata)
{

	LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata);
	if (!item) return NULL;

	LLUUID id = item->getUUID();

	// use supplied name by default
	std::string fullname = value["name"].asString();
	switch(value["target"].asInteger())
	{
	case GROUP:
		gCacheName->getGroupName(id, fullname);
		// fullname will be "nobody" if group not found
		break;
	case SPECIAL:
		// just use supplied name
		break;
	case INDIVIDUAL:
	{
		LLAvatarName av_name;
		if (id.isNull())
		{
			fullname = LLTrans::getString("AvatarNameNobody");
		}
		else if (LLAvatarNameCache::get(id, &av_name))
		{
			if (mShortNames)
				fullname = av_name.mDisplayName;
			else
				fullname = av_name.getCompleteName();
		}
		else
		{
			fullname = " ( " + LLTrans::getString("LoadingData") + " ) ";
			// ...schedule a callback
			LLAvatarNameCache::get(id,
				boost::bind(&LLNameListCtrl::onAvatarNameCache,
					this, _1, _2, item->getHandle()));
		}
			break;
		}
	default:
		break;
	}
	
	// Append optional suffix.
	std::string suffix = value["suffix"];
	if(!suffix.empty())
	{
		fullname.append(suffix);
	}

	LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
	if (cell && !fullname.empty() && cell->getValue().asString().empty())
	{
		cell->setValue(fullname);
	}

	dirtyColumns();

	// this column is resizable
	LLScrollListColumn* columnp = getColumn(mNameColumnIndex);
	if (columnp && columnp->mHeader)
	{
		columnp->mHeader->setHasResizableElement(TRUE);
	}

	return item;
}