Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
iggrid picklist not rendered when datasource set to webapi
posted

Hi,

have this problem that when use static json data for datasource then picklist is getting rendered and  show up as combobox

but when I use same data from webapi picklist doesn't show up and related column is empty without combobox.

 $("#grid1").igGrid({
                width: '100%',
                columns: gridcolumns,
                dataSource: dataURL,
                features: [
                ],
                rendered: function (evt, ui) {
                    tmpl = "<div id=grdpicklist_${ID}></div>";
                    $('#grid1').igGrid('setColumnTemplate', 'Company', tmpl);
                },
            });

  dataSource = $("#grid1").igGrid("option", "dataSource");
            $.each(dataSource, function (index, row) {
                $("#grdpicklist_" + row.ID).CustomPickList({
                    'id': 'grdpicklist_' + row.ID,
                    'dataSource': PickListData,
                    'contentType': 'application/json',
                    'valueKey': 'ID',
                    'textKey':  'Company',
                    'selected': row.ID,
                    'externalColumns': PickListCols,
                    'module': 'Project',
                    'callback': onGridPicklistSelection
                });
            });

what can be a problem here? When I switch data source to local json array it works.

thanks

Parents
  • 80
    Offline posted

    Hello Robson Wild,

    Thank you for posting in our community.

    In the code snippet provided, you are subscribing to "rendered" event, which is fired only prior initialization of the grid and when the whole grid has been rendered (including headers,footers,etc.).

    In the "setColumnTemplate" method there is one additional (optional) parameter called "render" which makes the grid rerender after template is set.

    Could you please try setting it to true like this:

    rendered: function (evt, ui) {
                        tmpl = "<div id=grdpicklist_${ID}></div>";
                        $('#grid1').igGrid('setColumnTemplate', 'Company', tmpl, true)

    }

    and see if that helps?

    If the desired behavior is not achieved, could you please attach a small sample where the specific issue does reproduce so I can provide further help?

    Best Regards,

    Martin Dragnev,

    Infragistics

Reply Children