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

Added <option> disable. #933

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added <option> disable. #933

wants to merge 2 commits into from

Conversation

perdodi
Copy link

@perdodi perdodi commented Oct 3, 2017

Makes possible to disable options in <select> dropdowns.

Example:

{
    name: "Country",
    type: "select"
    items: [
         { Name: "United States", Id: 0 },
         { Name: "Canada", Id: 1, disabled: true },
    ],
    valueField: "Id",
    textField: "Name"
}

Copy link
Owner

@tabalinas tabalinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, take a look at couple nit comments.

Also keep dist/* files unchanged (they changed only for released code)


var $option = $("<option>")
.attr("value", value)
.text(text)
.appendTo($result);


$option.prop("disabled", (disabled === true));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep indentation consistent: 4 spaces.

@@ -100,13 +100,15 @@

$.each(this.items, function(index, item) {
var value = valueField ? item[valueField] : index,
text = textField ? item[textField] : item;
text = textField ? item[textField] : item,
disabled = item['disabled'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use double-quotes usually, let's be consistent. While I'd rather just use dot notation here:
disabled = (item.disabled === true).

@zxcmaurya
Copy link

zxcmaurya commented May 30, 2018

Hello, I need to do same operation in my code. I need to disable <option> once it selected and inserted as a row in grid. Please help.

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

Successfully merging this pull request may close these issues.

3 participants