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

BUG : Update with isCover False, resend the first data in the select #43

Open
fredb8x opened this issue Dec 11, 2018 · 2 comments
Open

Comments

@fredb8x
Copy link

fredb8x commented Dec 11, 2018

Hello, the update method to add some new options values doesn't work,
Even in your page exemple (https://janking.github.io/dropdown/).

if i select the first and last value and click on the ajax bouton to update data,
all the first data block is duplicate.

Can you correct this pb ?
Thank you

@shirishwebonise
Copy link

shirishwebonise commented Dec 11, 2018

@fredb8x
Probably you are seeing duplicates because

  1. in the example, false value is used for isCover which means that the options are not replaced,
  2. the data comes from a mock library hence its highly possible that the same strings are being generated.

Can you share what you have already tried?

@fredb8x
Copy link
Author

fredb8x commented Dec 12, 2018

Hello this is the exemple of data :
var classetData1 = [
{
"id": "IIa",
"disabled": false,
"groupName": "Classe de dispositif médical",
"groupId": 1,
"selected": false,
"name": "IIa",
"idtag": "groupeA"
}
];
var classetData2 = [
{
"id": "I",
"disabled": false,
"groupName": "Classe de protection contre les chocs électriques",
"groupId": 2,
"selected": false,
"name": "I",
"idtag": "groupeB"
}
];

And my fonction, i had the second set after a choice:
var dropdown = $('.classProduct-multiple').dropdown({
searchable:false,
multipleMode: 'label',
limitCount:5,
data:classetData1,
extendProps:['idtag'],
choice : function () {
// console.log(arguments,this);
var selectedItemId = arguments[1]["id"];
var selectedGroupId = arguments[1]["idtag"];
updateMultipleSelectGroup(selectedGroupId, selectedItemId);
console.log("selectedItemId", selectedItemId);
if (selectedGroupId == 1) {
$(this).update(classetData2,false);
}
}

}).data('dropdown');

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

2 participants