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

Retaining order of elements after POST

13 Answers 152 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
iCognition
Top achievements
Rank 1
iCognition asked on 18 Nov 2013, 10:23 PM
Hi I have a list of items in a multiselect and I want them to be received in the order that the user has specified when being sent to the controller

Right now they seem to be sorted by whatever the datasource is sorted by.

Any tips?

13 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 20 Nov 2013, 12:55 PM
Hi Matt,

I would recommend you to check this example which demonstrates similar behavior.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
iCognition
Top achievements
Rank 1
answered on 20 Nov 2013, 10:22 PM
There is no server involved in that example

How can I insert those ordered elements back into the MultiSelect's input element to retain order on POST?

Surely an widget which displays an ordered list should behave like one
0
Alexander Popov
Telerik team
answered on 21 Nov 2013, 12:54 PM
Hi Matt,

I am not sure I understand you correctly. In this screencast you can see that the data is sent in the order it was selected by using the dataItems method and a simple Ajax request.
Let me know if I am missing something.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
iCognition
Top achievements
Rank 1
answered on 21 Nov 2013, 11:58 PM
I don't think you understand, I would make a demo project but you don't support VS2013 yet and I'm not installing 2012 just to start one...

See attached image, below is the client code
@(Html.Kendo().MultiSelectFor(model => model.Values)
            .AutoBind(true)
            .DataSource(dataSource =>
            {
                dataSource.Read(Model.DataSource, "Field");
            })
            .DataTextField("Text")
            .DataValueField("Value"))
0
Alexander Popov
Telerik team
answered on 25 Nov 2013, 03:59 PM
Hello again Matt,

Indeed, I misunderstood your question and I apologize for that.
I reviewed the attached screenshot and now fully understand the issue. The screenshot however, does not reveal any of the implementation and there is not enough information to determine what is causing this. Could you please provide a runnable project where the issue is reproduced or at least the source code of the involved views and controllers? This would help us pinpoint the exact reason for this behavior.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
iCognition
Top achievements
Rank 1
answered on 26 Nov 2013, 02:38 AM
Why is this forum so buggy I can't upload anything and half my posts don't go through

edit: apparently it did upload but gave me an error anyway
0
Alexander Popov
Telerik team
answered on 27 Nov 2013, 10:12 AM
Hello Matt,

Thank you for the attached project. I examined it and noticed that the data is passed to the Controller through a form. Please note that when using such approach the browser is not sending the MultiSelect's values, but rather the value of select HTML element used for initializing it. You can see an example in the attached screenshot.
In the current scenario I would recommend passing the data using Ajax request - this will allow you to get the values of the MutiSelect's instance in the exact same order it was picked by the user.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
iCognition
Top achievements
Rank 1
answered on 27 Nov 2013, 10:23 PM
So is Kendo dropping support for forms?

It would have been nice to have it written somewhere that Kendo isn't going to be WCAG compliant
0
Alexander Popov
Telerik team
answered on 28 Nov 2013, 03:17 PM
Hello Matt,

This is a limitation coming from the fact, that when a form is submitted the browser sends the values of the HTML elements inside that form. KendoUI does not affect this behavior and therefore cannot fully support forms in the terms you expect it to.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
iCognition
Top achievements
Rank 1
answered on 28 Nov 2013, 10:13 PM
It's a bug.

Make the widget reorder the DOM multi select entries.
0
Alexander Popov
Telerik team
answered on 02 Dec 2013, 09:43 AM
Hello,

This is the the expected, standard behavior of the widget and I am afraid that the behavior you expect is currently not supported out of the box.
I would however, encourage you to submit this idea at KendoUI UserVoice, so we and other members of the community can evaluate, comment on and vote for it. Most voted ideas are included in next KendoUI releases.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Shehab
Top achievements
Rank 1
answered on 16 Dec 2014, 03:36 PM
I agree with Matt, this is not an acceptable behavior from the MultiSelect, and it should be supported.
0
Alexander Popov
Telerik team
answered on 18 Dec 2014, 09:36 AM
Hello Shehab,

Thank you for your feedback. I already explained why this is not supported and suggested to submit a feature request on our feedback portal. For convenience I also prepared an example showing how to manually reorder the items in the way they were selected in the widget.

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
MultiSelect
Asked by
iCognition
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
iCognition
Top achievements
Rank 1
Shehab
Top achievements
Rank 1
Share this question
or