DataView hides the added item

Hi, I am using a DataView inside a Form like this:

function Init()
{
    initializeProductsForm();
    initializeCategoryDataView();
}

function initializeProductsForm()
{
    var formData = [
        {
            type: "settings",
            position: "label-left",
            inputWidth: 220
        },
        {
           type: "template",
           name: "related",
           format: "doRelated",
           label: 'Related Products',
           position: 'label-top',
           labelAlign: 'center',
           offsetTop: 20
        }       
    ];

    myForm1 = new dhtmlXForm("formContainer", formData);
}

function initializeCategoryDataView()
{
    view = new dhtmlXDataView({
        container: 'related',
        type: {
            template: "<div align='center'><img onmousedown='return false;' width='24' height='24' border='0' src='{common.image()}'><div class='dhx_item_text'>#text#</div></div>",
            css: 'ficon',
            width: 30,
            height: 30,
            image: function (obj)
            {
                return "../modules/views/dhtmlxTree/sources/imgs/ok/" + obj.icon;
            }
        },
        drag: true,
        select: true,
        height: 400,
        icon: 'product.png',
        text: 'New'
    });

    attachProductsDataViewEvents();
    view.add({
       text: 'New Prod',
       image: 'product.png'
     });
  
}

function doRelated(name, value)
{
    return "<div id='related'></div>";
}

but the ‘New Prod’ item doesn’t show up until I drop another item into the DataView container.

I have already debugged the project, but found nothing else but this awful solution.

setTimeout(function () { view.add( { text: 'New Prod', image: 'product.png' }); }, 6000);

P.S. It only works if time is greater than 5000

Before calling initializeCategoryDataView(); the HTML contains this:

which is the expected behavior.

Before calling view.add(…);

which is the expected behavior.

Please help me to find my mistake

The attachment does not mean nothing it was a newbie’s mistake on its 2nd post

Hi
Could you provide us a whole demo to reprocude the issue?
If you have PRO version, please, create the ticket or send it on support@dhtmlx.com with link to this topic.
docs.dhtmlx.com/doku.php?id=othe … leted_demo

i have found the problem, but i don’t know how to fix it.

TThe problem is that after the call to initializeCategoryDataView function, in the Init() function i hide the Form’s container using JQuery, like this:

$('#formContainer').hide();

Then in an other button click event I show the Form, like this:

$('#formContainer').show();

The Forms shows up with the DataView component inside it. But the dataview has no items.

If you add a other items, then the two items (the hidden item and the new one) appears.

Tell me if this isn’t enough, to upload a full demo, but the demo is almost everything I had post here

After making dataview visible call something like

dataview.refresh();

to repaint the dataview

Thanks a lot