This is a migrated thread and some comments may be shown as answers.

Listbox on Modal

5 Answers 105 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Enrico
Top achievements
Rank 1
Enrico asked on 15 Aug 2018, 09:42 AM

Hi, I'm having a problem on rendering my listbox every time I call my modal.

 

Please see the attached file.

here's my code:

<div class="modal fade" id="assign-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="max-width:790px!important;">
        <div class="modal-content">
            <div class="modal-header" style="display:block">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="myModalLabel">t</h4>
            </div>
                <div class="modal-body">
                    <input type='text' id='searchBox' class='k-textbox' placeholder='Search' />
                    <div id="example" role="application">
                        <div class="demo-section k-content">
                            <div>
                                <label for="optional" id="agents">FROM</label>
                                <label for="selected">TO</label>
                                <br />
                                <select id="unoptional"></select>
                                <select id="unselected"></select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button id="SaveEdit" type="button" data-save class="btn btn-primary">Assign</button>
                    <button type="button" class="btn btn-default" data-cancel>Cancel</button>
                </div>
        </div>
    </div>
</div>

 

$("#optional").kendoListBox({
                    connectWith: "selected",
                    dataTextField: "FullName",
                    dataValueField: "FullName",
                    selectable: "multiple",
                    toolbar: {
                        tools: ["transferTo", "transferFrom", "transferAllTo", "transferAllFrom"]
                    },
                    dataSource: {
                        serverPaging: true,
                        transport: {
                            read: {
                                url: myUrl,
                                dataType: "json"
                            },
                            schema: {
                                model: {
                                    fields: {
                                        FullName: { type: "string" },
                                        Id: { type: "string" }
                                    }
                                }
                            }
                        }
                    }
            });
            $("#selected").kendoListBox({
                dataTextField: "FullName",
                dataValueField: "FullName",
                selectable: "multiple",
            });

 

5 Answers, 1 is accepted

Sort by
0
Enrico
Top achievements
Rank 1
answered on 20 Aug 2018, 03:57 AM
Any update?
0
Konstantin Dikov
Telerik team
answered on 20 Aug 2018, 05:18 AM
Hi Enrico,

In the attached screenshot it seems that the ListBox widgets are correctly initialized, so could you please elaborate what is the exact issue that you are facing? If the problem is with the missing data, you could see if the dataSource configuration is correct.

You can also inspect the browser's console for any JavaScript errors that could help you identify the root of the problem.

If the problem persists, please try to isolate the issue in a dojo example that we can test and debug locally:

Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Enrico
Top achievements
Rank 1
answered on 20 Aug 2018, 08:17 AM

hi Konstantin,

There's no issue with the data. the problem is in the layout. as you can see on my screenshot, the tools rendered 3 times as well as $("#optional").kendoListBox().

 

Thanks,

Enrico

0
Enrico
Top achievements
Rank 1
answered on 23 Aug 2018, 03:38 AM
Any updates?
0
Konstantin Dikov
Telerik team
answered on 23 Aug 2018, 07:25 AM
Hello Enrico,

It is possible that you are initializing the ListBox multiple times, but without an example that we can test and debug locally it will be really difficult to pinpoint the root of the problem. Could you please try to isolate this in a dojo example that we can test locally?


Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ListBox
Asked by
Enrico
Top achievements
Rank 1
Answers by
Enrico
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or