JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › Problems with dropdownlist editor
- This topic has 12 replies, 2 voices, and was last updated 2 years, 11 months ago by
admin.
-
AuthorPosts
-
February 28, 2022 at 5:17 pm #102904
tullio0106@live.it
ParticipantIn my grid I’ve a field which uses a dropdown list as editor :
{ label: ‘Campo combo 1’, dataField: ‘C4’, template: ‘dropdownlist’, editor:{
template: ‘<smart-drop-down-list></smart-drop-down-list>’,
onInit(row, column, editor) {
const dropDownList = (editor.firstElementChild);
dropDownList.dataSource = [‘SEAVISION’, ‘AXIOMA’, ‘WAM’, ‘FAAC’];
dropDownList.dropDownAppendTo = ‘body’;
}}},When I try to change the value I see a strange situation :
. first time I click to open the value I setted disappears and the dropdown doesn’t open
. when I click a second time the dropdown list opens
. I choose a value
. when i leave the field I det an error : t.replace is not a function
Tks
Tullio
-
This topic was modified 2 years, 11 months ago by
tullio0106@live.it.
February 28, 2022 at 6:59 pm #102906admin
KeymasterHi,
Thank you for writing.
The onRender and getValue callbacks should be added with the custom grid editor here. Please, take a look at https://www.htmlelements.com/demos/grid/editing-cascading/ which shows how to implement a custom Dropdownlist cell editor in the datagrid.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 1, 2022 at 9:56 am #102912tullio0106@live.it
ParticipantA little bit better but some problems are present.
When I click on the button the dropdown doesn’t show and the content is cleared : I need to click another time in order to show the dropdown.
When the value is cleared, if I press tab I get an error : t is undefined.
Least but not last the dropdown apparence is different from your example and my implementation : the heigth of every element in the dropdown is much higher in my implementation but I didn’t set any css class.
Tks
March 1, 2022 at 11:29 am #102916tullio0106@live.it
ParticipantThe topic is reproduced by an example.
How can I upload it to you ?
Tks
March 1, 2022 at 12:04 pm #102918admin
KeymasterHi,
You can share a codepen example – https://codepen.io/
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 1, 2022 at 1:31 pm #102920tullio0106@live.it
ParticipantHere the codpen link : https://codepen.io/tullio0106/pen/JjOebye
This is the beverage.json data I used
[{
“C1”: “1”,
“C2”: “Hot Chocolate”,
“C4”: “SEAVISION”,
“C6”: “01/06/1954”,
“C5”: “true”,
“C3”: “14g”
}]Tks
March 7, 2022 at 10:15 am #102933tullio0106@live.it
ParticipantNobody can help about this topic ?
Tks
March 7, 2022 at 12:02 pm #102935admin
KeymasterHi,
I cannot see a grid in the provided example.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 7, 2022 at 12:10 pm #102938tullio0106@live.it
ParticipantMay be you looked to a wrong codpen address
This is the html content
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Grid Cell Editing Confirm Dialog Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="../../../source/styles/smart.default.css" />
<link rel="stylesheet" type="text/css" href="../../../styles/demos.css" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<script src="../../../../common/data.js"></script>
</head>
<body class="viewport">
<div class="demo-description">
<h1>Grid Cells Editing Confirm Tullio</h1>
We implement the 'onCellUpdate' Grid function. When a cell value is edited, 'onCellUpdate' is called. That callback can be used for Client-Server validation of the Cell Editing. The function is implemented for the 'Quantity' column and we simulate Ajax call to a Web Server by using setTimeout and
confirm the changes by calling the 4th argument of 'onCellUpdate', which is a function. When we call it with 'true', changes are confirmed. Otherwise, they are canceled. In this example, when the 'Quantity' is > 10, changes are confirmed.
</div>
<smart-grid id="grid"></smart-grid><!-- scripts -->
<script src="../../../common/data.js"></script>
<script type="module" src="../../../source/modules/smart.grid.js">
</script>
<script type="module" src="../../../source/modules/smart.button.js">
</script>
<script type="module" src="index.js">
</script>
</body>
</html>and the grid is there.
Tks
March 7, 2022 at 4:54 pm #102940admin
KeymasterHi tulio,
I meant that the codepen provided is invalid because nothing is seen in it. The issue is that the editor is not implemented as in the sample I referred to and that the data source is invalid. While the sample binds to beverages.json, your columns do not and the Grid is empty without any data loaded. It looks like that you want to use the grid in unbound mode as a spreadsheet and add dropdownlist editor to it. Is that right?
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/March 8, 2022 at 8:46 am #102944tullio0106@live.it
ParticipantSorry but I dont understand the point.
the file, named beverages.json shoult contain :
[{
“C1”: “1”,
“C2”: “Hot Chocolate”,
“C4”: “SEAVISION”,
“C6”: “01/06/1954”,
“C5”: “true”,
“C3”: “14g”
}]as indicated before .
Using theese data, I tested it again, I see the grid with a row of data as expected.
Tks
March 24, 2022 at 3:42 pm #102990tullio0106@live.it
ParticipantNo further help ?
March 24, 2022 at 3:49 pm #102992admin
KeymasterHi,
This issue should have been already resolved in the latest version.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/ -
This topic was modified 2 years, 11 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.