Table with components in cell lvgl 8.2


When using the table component I would like to add another component in one of the cells, I followed the documentation under Table (lv_table) — LVGL documentation and tried to load a dropdown but looks like it places it in a wrong position

What MCU/Processor/Board and compiler are you using?

ESP32 & TFT Simulator

What LVGL version are you using?


What do you want to achieve?

I would like the table load another component inside the cells

What have you tried so far?

Code to reproduce

static void draw_event_cb(lv_event_t * e)
    lv_obj_t * obj = lv_event_get_target(e);
    lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
    /*Create a normal drop down list*/
    lv_obj_t * dd = lv_dropdown_create(obj);
    lv_dropdown_set_options(dd, "Apple\n"

    lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20);

static void change_event_cb(lv_event_t * e)
    lv_obj_t * obj = lv_event_get_target(e);
    uint16_t col;
    uint16_t row;
    lv_table_get_selected_cell(obj, &row, &col);
    bool chk = lv_table_has_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1);
    if(chk) lv_table_clear_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1);
    else lv_table_add_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1);
void lv_example_table_2(void)
    uint32_t t = lv_tick_get();

    lv_obj_t * table = lv_table_create(tab4);

    /*Set a smaller height to the table. It'll make it scrollable*/
    lv_obj_set_size(table, 300, 200);

    lv_table_set_col_width(table, 0, 290);
    lv_table_set_row_cnt(table, 10); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
    lv_table_set_col_cnt(table, 1);

    /*Don't make the cell pressed, we will draw something different in the event*/
    lv_obj_remove_style(table, NULL, LV_PART_ITEMS | LV_STATE_PRESSED);

    uint32_t i;
    // for(i = 0; i < 10; i++) {
    //     lv_table_set_cell_value_fmt(table, i, 0, "Item %"LV_PRIu32, i + 1);
    // }
    lv_table_set_cell_value_fmt(table, 0, 0, "Serial speed", 0);

    lv_obj_align(table, LV_ALIGN_CENTER, 0, -20);

    /*Add an event callback to to apply some custom drawing*/
    lv_obj_add_event_cb(table, draw_event_cb, LV_EVENT_DRAW_PART_END, NULL);
    lv_obj_add_event_cb(table, change_event_cb, LV_EVENT_VALUE_CHANGED, NULL);


Screenshot and/or video