-
Notifications
You must be signed in to change notification settings - Fork 505
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
Multiselect dropdown list #52
Comments
I got the soln for it. Thanks. Ex.
feel free to bug me.. cheers!! |
Thanks for your suggestion and solution :) I will add it to next versions of the jTable. |
I attempted this as well as just using a custom input field. Both cases create the multi select when creating a record. But the AJAX post only sends the last selected value of the multi select (when more than one items are selected). I can't seem to figure out why. I think it should be sending "value1,value2,value3". Perhaps somewhere there needs to be an array instead of a regular variable. Thoughts anyone? |
I tested it. jTable sends all selected items. It's about your server side codes. See the post in chrome dev tools: jTable sends three CityId values to the server. Also, to make a select dropdown as multiple, easy way is to use formCreated (http://jtable.org/ApiReference#event-formCreated) event: formCreated: function(event, data) { data.form.find('select[name=CityId]').attr('multiple','multiple'); } |
Hello, @hikalkan jtable is great! We have tried the code above but with no success :-( and we have made a little hack in order to accept a new type called multi, that is a select multiple. With the purpose of respecting your great code, we have added in a different file this way: Create a file called jquery.table.anadido.js with the following content: $.hik.jtable.prototype._fillDropDownListWithOptions = function ($select,
Now, when you add jquery.jtable.js you have to add below this recently created file: <script src=\"/jtable/jquery.jtable.anadido.js\" type=\"text/javascript\"></script>And then when you define the structure:
Thank you very much and feel free for using and modifying this little hack. |
thanks for your work but the both method doesn't work with jquery.jtable.aspnetpagemethods.js. the record object only contain one object (string no string[]). I will check for a solution... have a good day. |
Hello, What a pity! :-( I'm sorry. It is working for me properly, I hope you could Thank you in advance. Yours, 2013/5/27 caca9512 [email protected]
Galder Segurola Hostinet S.L wget -O - http://www.hostinet.com/galder_hostinet.asc | gpg --import |
hi galde, thank you for your quick response. Do you code in php or asp.net? |
Hello, :-) I code in php.net Thanks in advance, 2013/5/28 caca9512 [email protected]
Galder Segurola Hostinet S.L wget -O - http://www.hostinet.com/galder_hostinet.asc | gpg --import |
Ok for all user of asp.net, i found the solution. I show you my file jtable.table.YOUNAME.js $.hik.jtable.prototype._fillDropDownListWithOptions = function ($select, options, value) { if (field.type == "multi") $.hik.jtable.prototype._convertQueryStringToObject = function (queryString) { while (e = r.exec(queryString)) {
} return jsonObj; The object in my c# class is string[]. Good luck to all. |
ok cut and paste scrap code. Go to this url for see solution: https://gist.github.com/caca9512/5662735 |
Hi, does the code works for only when you select multiple options in the listbox? Because i'am having trouble when the user selects only one option. |
Working for the both case... I using MVC 3 with string[] property in my model. |
It's strange, I also have string[] in my model: And i'm getting this error when the user selects only one option |
Are you include <script type="text/javascript" src="/Scripts/jtable/external/json2.js"></script> |
I don´t use third party controls. What is the json you send in your form? When the user selects multiple options, jtable sends: {"record":{"LineaIDArray":["15","16"]}} but when selecting only one option, jtable sends it like a string: {"record":{"LineaIDArray":"15"}} when I think it should be sending it like string[] {"record":{"LineaIDArray":["15"]}} |
same for me {"record":{"Role":"Administrator"}} but in my mvc model Role variable contain a string[1]... Can you post controller code and Model code? |
this is my model's code [Serializable]
} and this is my controller's code for the create action [WebMethod]
|
hi caca9512 your code is not working in Asp.net, can you provide me the comlete .js file for Asp.net c# not for MVC i.e, the script file you did changes. Can you please help me its urgent. i m getting error as Thanks in advance |
prasanthchinna : https://gist.github.com/caca9512/5662735 |
cianpi1e : Test with [HttpPost] no webMethod. |
Thanks for your quick response, Can you give it in webMethod please. I m trying from past 3 days using webmethod but not getting |
prasanthchinna, I had the exact same problem as you, but I was getting this error because the post was sending a string, but the model was expecting a string[]. What is the code in your model? |
Hi caca9512 you are giving "_convertQueryStringToObject " method may i know what for it |
Hi hikalkan can you please provide us the code for asp.net webmethod, we are struggling a lot |
Used in ASP.NET MVC To use, set the type on the field to 'multiselectddl'. The options dropdown will become a select. Data is treated as comma delimited. Based off of info from: volosoft#52
@grvgtm Hi gaurav .... can you please tell me what does this function do ?? 'getOptionsWithCaching(fieldName)' ?? |
hi maryum426, this function return a array on value id you use a multiselect dropdown (jtable type :multi). |
@caca9512 got it .... Thanks |
I had to do some modifications to current https://github.com/stanleyta/jtable/blob/master/lib/jquery.jtable.js
To use this I have the following code:
This formSubmitting hook is required since my PHP backend only uses the last value from several selected if variable name does not have [] in the end. |
hi pash7ka, I tried your solution but the dependsOn still wouldn't work. Has the support for the jquery jtable stopped? I just downloaded the latest update from the link specified on the site and I didn't find an implementation for the multiple select and a dependsOn attribute. This is really a big flaw of the jtable. Presently, I am looking for a workaround for this problem because I have seen no straight forward solution to this problem. |
Hi, |
"multi-select" in jQuery jTable working fine. I save it as comma separated values. How to display multiple selected values while editing ?? |
I was wondering, how can I implement multiselect dropdown ??
Please suggest the best way to do multiselect dropdown in jTable. Looking forward to hear from you guys asap.
cheers!!
gaurav
The text was updated successfully, but these errors were encountered: