Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setList Nested list problem #85

Closed
cengmustafaalan opened this issue Apr 18, 2018 · 4 comments
Closed

setList Nested list problem #85

cengmustafaalan opened this issue Apr 18, 2018 · 4 comments

Comments

@cengmustafaalan
Copy link

cengmustafaalan commented Apr 18, 2018

i was using setList method well for a simple repeater without inner list

i am using JsonConvert.SerializeObject for convert my c# list to json. "data" is a json result from my action method.

var obj = JSON.parse(data); repeater.setList(JSON.stringify(obj));

but now in my case, i need to set list into my nested list too. but its not working.

i have Json result from my action method like

[{"Name":"Name1","TryingExamId":4,"TryingExamSectionLessons":[{"TryingExamSectionId":5,"LessonId":1,"QuestionCount":15,"DisplayOrder":1,"Id":8,"Guid":"b3d0ba9f-6a30-48e2-8e05-eb5ec61decef","CreatedOn":"2018-04-17T14:59:31.727","CreatedOnStr":"17.04.2018 - 14:59","UpdatedOn":"2018-04-17T14:59:31.727","UpdatedOnStr":"17.04.2018 - 14:59","IsDeleted":false},{"TryingExamSectionId":5,"LessonId":2,"QuestionCount":15,"DisplayOrder":2,"Id":9,"Guid":"6f2c3ac4-c186-4ea7-9180-b02a3a619344","CreatedOn":"2018-04-17T14:59:42.4","CreatedOnStr":"17.04.2018 - 14:59","UpdatedOn":"2018-04-17T14:59:42.4","UpdatedOnStr":"17.04.2018 - 14:59","IsDeleted":false}],"Id":5,"Guid":"bbaa126c-5adb-4e69-9f24-42d7d69349c4","CreatedOn":"2018-04-17T14:57:45.19","CreatedOnStr":"17.04.2018 - 14:57","UpdatedOn":"2018-04-17T14:57:45.19","UpdatedOnStr":"17.04.2018 - 14:57","IsDeleted":false},{"Name":"Name2","TryingExamId":4,"TryingExamSectionLessons":[{"TryingExamSectionId":6,"LessonId":3,"QuestionCount":15,"DisplayOrder":3,"Id":10,"Guid":"566c2d5d-a17c-4a0e-9551-301ada509d02","CreatedOn":"2018-04-17T15:00:12.46","CreatedOnStr":"17.04.2018 - 15:00","UpdatedOn":"2018-04-17T15:00:12.46","UpdatedOnStr":"17.04.2018 - 15:00","IsDeleted":false},{"TryingExamSectionId":6,"LessonId":5,"QuestionCount":15,"DisplayOrder":4,"Id":11,"Guid":"5748fdd4-7a3e-4966-b8c5-e3fc705fe857","CreatedOn":"2018-04-17T15:00:13.593","CreatedOnStr":"17.04.2018 - 15:00","UpdatedOn":"2018-04-17T15:00:13.593","UpdatedOnStr":"17.04.2018 - 15:00","IsDeleted":false},{"TryingExamSectionId":6,"LessonId":6,"QuestionCount":15,"DisplayOrder":5,"Id":12,"Guid":"b59e8e19-c973-403b-a64b-d4ddf5186d4e","CreatedOn":"2018-04-17T15:00:13.647","CreatedOnStr":"17.04.2018 - 15:00","UpdatedOn":"2018-04-17T15:00:13.647","UpdatedOnStr":"17.04.2018 - 15:00","IsDeleted":false}],"Id":6,"Guid":"2ebb080e-2006-4ccb-9385-82d2555d9fee","CreatedOn":"2018-04-17T14:59:59.53","CreatedOnStr":"17.04.2018 - 14:59","UpdatedOn":"2018-04-17T14:59:59.53","UpdatedOnStr":"17.04.2018 - 14:59","IsDeleted":false}]"

TryingExamSectionLessons are my nested list item but its not setting to repeater. outer-list setting but nested list are not.

Do you have any solution ?

@vdomah
Copy link

vdomah commented Jun 24, 2018

hello!
have you solved this? How?

@ehsanmusavi
Copy link

I have the same issue :(

@cengmustafaalan
Copy link
Author

cengmustafaalan commented Aug 15, 2018

hello.
I was create this issue on stackoverflow. I solved this problem by myself. I was using

var $repeater = $('.repeater').repeater({

            defaultValues: {
                Id: '0'
            },
            initEmpty: true,
            show: function () {

                $(this).slideDown();
                //$(this).find('.bs-select').selectpicker('refresh');
                debugger;
            },
            repeaters: [{
                selector: '.inner-repeater',
                //initEmpty: true,
                show: function () {
                    // this method will work when only click add button
                    debugger;
                    var $this = $(this);
                    $(this).find('.bs-select').selectpicker('refresh');

                    var OrLessonPlace = $(this).find("#OrLessonPlace");
                    $(this).find('#checkbox').change(function () {
                        if ($(this).is(":checked") == true) {
                            OrLessonPlace.show();
                        }
                        else {
                            OrLessonPlace.hide();
                        }
                    });

                    $(this).slideDown();
                },
                //initEmpty: true,
            }]
        });

show funtion was not working (under repeaters). I delete "show" function and it worked for me .

You can see my View and data in here

Have a nice day.

@ehsanmusavi
Copy link

ehsanmusavi commented Aug 16, 2018

Not working for me, even with removing the show method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants