Skip to content

Added <option> disable.#933

Open
perdodi wants to merge 2 commits into
tabalinas:masterfrom
perdodi:master
Open

Added <option> disable.#933
perdodi wants to merge 2 commits into
tabalinas:masterfrom
perdodi:master

Conversation

@perdodi

@perdodi perdodi commented Oct 3, 2017

Copy link
Copy Markdown

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"
}

@tabalinas tabalinas left a comment

Copy link
Copy Markdown
Owner

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)

Comment thread src/fields/jsgrid.field.select.js Outdated
.appendTo($result);


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

Copy link
Copy Markdown
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.

Comment thread src/fields/jsgrid.field.select.js Outdated
var value = valueField ? item[valueField] : index,
text = textField ? item[textField] : item;
text = textField ? item[textField] : item,
disabled = item['disabled'];

Copy link
Copy Markdown
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

zxcmaurya commented May 30, 2018

Copy link
Copy Markdown

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