TableListBoxModel::paintCell not working like the way it should?

I’m trying to load a song and when this song loads it shows the name of the song in the TableListBox. Starting the program without anything in a “Tracktitles” vector (that stores the file names) causes the paintCell function to not call at all. Starting the program with at least one item in the vector calls the paintCell function but it doesn’t paint any of the new track titles that were pushed into the vector.

    // In your constructor, you should add any child components, and
    // initialise any special settings that your component needs.

    tableComponent.getHeader().addColumn("Track Title", 1, 400);
    tableComponent.getHeader().addColumn("Length", 2, 80);
    tableComponent.getHeader().addColumn("", 3, 120);



void PlaylistComponent::paint (juce::Graphics& g)
    /* This demo code just fills the component's background and
       draws some placeholder text to get you started.

       You should replace everything in this method with your own
       drawing code..

    g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));   // clear the background

    g.setColour (juce::Colours::grey);
    g.drawRect (getLocalBounds(), 1);   // draw an outline around the component

    g.setColour (juce::Colours::white);
    g.setFont (14.0f);
    g.drawText ("PlaylistComponent", getLocalBounds(),
                juce::Justification::centred, true);   // draw some placeholder text

void PlaylistComponent::resized()
    // This method is where you should set the bounds of any child
    // components that your component contains..

    tableComponent.setBounds(0, 0, getWidth(), getHeight());


int PlaylistComponent::getNumRows() {

    return trackTitles.size(); 

void PlaylistComponent::paintRowBackground(Graphics& g, int rowNumber, int width, int height, bool rowIsSelected) {

    if (rowIsSelected)
    else {
void PlaylistComponent::paintCell(Graphics& g, int rowNumber, int columnId, int width, int height, bool rowIsSelected) {

        if (columnId == 1) {
            g.drawText(trackTitles[rowNumber], // we will change this later
                2, 0,
                width - 4, height,

Component* PlaylistComponent::refreshComponentForCell(int rowNumber, int columnId, bool isRowSelected, Component* existingComponentToUpdate) {

    if (columnId == 3)
        if (existingComponentToUpdate == nullptr) {
            TextButton* btn = new TextButton{ "play" };
            String id{ std::to_string(rowNumber) };

            existingComponentToUpdate = btn;


    return existingComponentToUpdate;

void PlaylistComponent::buttonClicked(Button* button) {

    int id = std::stoi(button->getComponentID().toStdString());


void PlaylistComponent::getTracks(File tracks) {