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

EditorTemplate Example for BitMask field

3 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 11 Dec 2018, 01:00 AM

Does anyone have an example of an EditorTemplate for a Grid that handles a BitMask field?

 

Thanks

M

3 Answers, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 13 Dec 2018, 02:49 PM
Hi Mike,

If you would like to restrict the user from typing in digits different than "0" and "1", you can create a custom rule for the Kendo UI MaskedTextBox. More information on the rules of the masked textbox can be found in the following article:

MaskedTextBox Configuration - rules.

If you elaborate in further detail on the exact scenario you are willing to achieve, I will be able to provide an accurate solution. For example, specify which numbers should be restricted from submitting and which should be allowed.

As a side note, you can find more information on how to set up a widget in the Editor Template can be found here:

Editor Templates

Should you need additional information, let me know.


Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Mike
Top achievements
Rank 1
answered on 13 Dec 2018, 04:47 PM

I am looking for a custom multiselect editor for a grid popup editor that can take key value pairs setup in a bitmask style and store and retrieve the resulting kv pairs in the multiselect.

For example, if the multiselect contains the following dataset:

1, Data A

2, Data B

4, Data C

8, Data D

16, Data E

 

If the user chooses Data E and Data A, the resulting value is 17 and when the value 17 is assigned the multiselect shows Data A and Data E.

If the user chooses Data E, Data D and Data B, the value 26 is stored and when 26 is assigned to the value property the multiselect would show Data E, Data D and Data B.

 

 

 

0
Tsvetomir
Telerik team
answered on 18 Dec 2018, 08:38 AM
Hi Mike,

The Kendo UI Multiselect widget allows both for getting and setting its value programmatically. This can be done via the value() method. You can find an example of how to get and set the value of the Multiselect here:

http://dojo.telerik.com/egaQUNIQ

In your scenario, you can retrieve the values from the Multiselect, sum them up and save them according to your preferences. Afterward, when needed, write an algorithm which will return the values in an array from which the sum has been comprised of. Then pass the array to the value() method of the Multiselect.

Note that this is a rather custom implementation, and the solution has to be written according to the developer's preferences. 


Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Mike
Top achievements
Rank 1
Share this question
or