Re: [ANGULAR] Unable to display value on edit cell, if the column has value of array
Posted: Fri Jan 21, 2022 12:29 pm
by abisht
Regarding online example, The Birthplace column must be reading a value from
"city" :"Moscow"
Since I don't know how to play with data, can you please try with :
"city" : ["Moscow"]
Re: [ANGULAR] Unable to display value on edit cell, if the column has value of array
Posted: Fri Jan 21, 2022 1:15 pm
by alex.l
Well, driver is a really Object in your data, that's why you see that as [object Object], it should be a value.
"city" : ["Moscow"]
it won't work, because value is an Array.
Try to make data in format you need (DriverCode is a String) before set it to store (in here this.driverService.searchDrivers().subscribe((). This is the easiest way.
Re: [ANGULAR] Unable to display value on edit cell, if the column has value of array
Posted: Fri Jan 21, 2022 1:18 pm
by abisht
Issue is , I can have more than 1 driver in each shipment. In that case, value will be an array right?
Re: [ANGULAR] Unable to display value on edit cell, if the column has value of array
Posted: Fri Jan 21, 2022 2:20 pm
by alex.l
In case you have an array of drivers, do you have ids for all these drivers or you want to add them all at once? I don't really follow how this data will be stored in 1 field of the record you are editing. I know it multiSelect combo, bit will it still be an array, or it will be an array of arrays?
You can do join(' ,') if you want to select them as 1 value, or you still may go throw all your drivers and create an array of id/value objects.
Could you please describe a full logic process, how do you want to display them, what data you want to save in your drivers field, how do you expect to see a record in your combo list?
Re: [ANGULAR] Unable to display value on edit cell, if the column has value of array
For same shipment, I have two driver, as part of driver array and my column driver , is able to use the render method to join driver name :
renderer: ({ value }) => {
return value && value.length > 0 ? value.map(data => data.driverName).join(', ') : '';
},
My expectation is : Even though its an array of drivers, but on double click, it should now show [Object Object]
For now, multiselect is disabled. So I can only assign one driver.
Re: [ANGULAR] Unable to display value on edit cell, if the column has value of array
Re: [ANGULAR] Unable to display value on edit cell, if the column has value of array
Posted: Fri Jan 21, 2022 2:59 pm
by abisht
This method is used to load the driver dropdown, when the column is opened in edit mode. That is working fine.
The only issue is, when I double click on the cell, it show [object object].
This grid, is populated using /getShipmentByDate API, which has a list of drivers . Which on double click generates [Object object]
while for dropdown, I am using a separate /getDrivers api, which is working fine.