- Home
- Forum
- JavaScript - EJ 2
- renderCell and dataBinding
renderCell and dataBinding
Hello,
Is it possible to call renderCell after dataBinding?
on dataBinding in result I have nonWorkingDays object e.actual.nonWorkingDays. Based ond that object/array I want to have label on cell thate represents description of non working day.


Is it possible to call renderCell after dataBinding?
on dataBinding in result I have nonWorkingDays object e.actual.nonWorkingDays. Based ond that object/array I want to have label on cell thate represents description of non working day.
ex. nonWorkingDays = {"25-12-2020", "Christmas"}
and on fetching data fore selected period ( dataBinding ) I want to setup all cells on 25-12 to have label Christmas.
I use 2 types of view
a) 1 day with all or one selected resource - here I want to target all cells in 30.05 ( it is holiday in Croatia ) for every resource
a) 1 day with all or one selected resource - here I want to target all cells in 30.05 ( it is holiday in Croatia ) for every resource
b) 1 week with one selected resource - here I want to target all cells in 30.05 ( it is holiday in Croatia )
Thanks in advance!
KR,
Ivan
Ivan
SIGN IN To post a reply.
3 Replies
HB
Hareesh Balasubramanian
Syncfusion Team
June 1, 2020 12:22 PM UTC
Hi Ivan,
Greetings from Syncfusion Support…!
No, it not possible to call renderCell event after the dataBinding event. We have also validated your requirement and suspect that your requirement is to fill all cells in particular date with the label and that you need to prevent the rendering of an event for those cells. By setting IsBlock field in datasource we can achieve this requirement by making use of block events. We have prepared below sample for your reference.
Code snippet:
|
dataBinding: function (args) {
var Holiday = new Date(2019, 0, 8);
var blockedData = [];
if (tempVal) {
var resCol = this.resourceCollection[0].dataSource;
for (var i = 0; i < resCol.length; i++) {
var data = {
Id: this.eventSettings.dataSource.length + 1,
IsBlock: true,
ConferenceId: resCol[i].Id,
Subject: 'Holiday Event',
StartTime: Holiday,
EndTime: Holiday,
IsAllDay: true
};
blockedData.push(data);
}
this.addEvent(blockedData);
tempVal = false;
}
} |
And for further reference, kindly refer to the below UG link,
Kindly try the above solution and revert us if you have any further assistance.
Regards,
Hareesh
IV
Ivan
June 1, 2020 04:39 PM UTC
Hello,
KR,
Ivan
thanks for the answer.
My goal is not to prevent creating new appointments on this dates, just to inform person of their schedule - so using block flag is not an option.
is there any way to access all cells from specific date and set specific css class and set innerHTML ( something like renderCell, but after dataBind )?
EDIT:
I think I found solution:
I think I found solution:
let cells = _scheduler.element.querySelectorAll('.e-work-cells');Here I fetch all work cells and check date with moment. If matched, add class and label.
for (let k = 0; k < cells.length; k++) {
let elem = $(cells[k]);
let timestamp = elem.attr('data-date');
let localDateString = moment(timestamp / 1000, 'X').format('YYYY-MM-DD');
if (localDateString === dateText) {
elem.addClass('non-working-day-' + employeeDataArr[0].UnreachableReason);
elem.removeClass('non-working-cell');
elem.html(_obligationsTranslate(employeeDataArr[0].UnreachableReason));
}
}
KR,
Ivan
HB
Hareesh Balasubramanian
Syncfusion Team
June 2, 2020 01:23 PM UTC
Hi Ivan,
Thanks for the update.
We have validated your reported query “is there any way to access all cells from specific date and set specific css class and set innerHTML” at our end. And for that, we have modified our previously updated sample and it can be viewed from the following link.
Code snippet:
|
dataBinding: function (args) {
var Holiday = new Date(2019, 0, 8);
var cellEle = document.querySelectorAll('.e-work-cells');
for (var i = 0; i < cellEle.length; i++) {
var date = parseInt(cellEle[i].getAttribute("data-date"));
if (new Date(date).setHours(0, 0, 0, 0) === Holiday.getTime()) {
cellEle[i].classList.add('custom');
cellEle[i].innerText = "Customized";
}
}
} |
And also we have modified the cells background color for the particular date and for further reference kindly refer to the below code snippet.
|
.custom {
background-color: darkgray !important;
} |
Kindly try the above solution and revert us if you have any further assistance.
Regards,
Hareesh
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
IV Ivan
- May 29, 2020 12:34 PM UTC
- Jun 2, 2020 01:23 PM UTC