如图:
如图:抵店时间的值是从地点日期里截取出来的。现在截取好了,也给抵店时间设置值了,但是flexGrid没有显示,代码片段如下:
- if (data != "" && data.length > 0) {
- var array_book = [];
- for(var i=0;i<data.length;i++){
- array_book.push({
- bookRoomId: data[i].bookRoomId,
- roomtypeId: data[i].roomtypeId,
- bookNum: data[i].bookNum,
- saveNum:data[i].saveNum,
- reachDate: new Date(data[i].reachDate),
- leaveDate: new Date(data[i].leaveDate),
- 抵店时间: "",
- roomPrice: data[i].roomPrice,
- reachNum: data[i].reachNum,
- buttons: "",
- });
- }
- /////// FlexGird ///////
- editBookRoomView = new wijmo.collections.CollectionView(array_book);
- editBookRoomFlexGrid = new wijmo.grid.FlexGrid('#div_bookRoom',{
- autoGenerateColumns: false,
- selectionMode: wijmo.grid.SelectionMode.Row,
- //allowResizing: wijmo.grid.AllowResizing.None,
- allowAddNew: true,
- columns: [
- {
- header: '主键',
- binding: "bookRoomId",
- width: 50,
- isReadOnly: false,
- visible: false
- },
- {
- header: '房类',
- binding: "roomtypeId",
- width: '*'
- },
- {
- header: '订房数',
- binding: "bookNum",
- width: '*'
- },
- {
- header: '留房数',
- binding: "saveNum",
- name: "saveNum",
- width: '*',
- isReadOnly: true
- },
- {
- header: '抵店日期',
- binding: "reachDate",
- format: 'yyyy-MM-dd',
- width: 100
- },
- {
- header: '离店日期',
- binding: "leaveDate",
- format: 'yyyy-MM-dd',
- width: 100
- },
- {
- header: '抵店时间',
- binding:'抵店时间',
- name:'抵店时间',
- width: 100
- },
- {
- header: '房价',
- binding: "roomPrice",
- width: '*'
- },
- {
- header: '抵达数',
- binding: "reachNum",
- width: '*'
- },
- {
- header: '操作',
- binding: "buttons",
- name: "buttons",
- width: '*'
- },
- ],
- itemsSource: editBookRoomView,
- });
-
- editBookRoomFlexGrid.itemFormatter = function(panel, r, c, cell) {
- if (panel.cellType == wijmo.grid.CellType.Cell) {
- var col = panel.columns[c],
- html = cell.innerHTML;
- if (r == editIndex) {
-
- } else {
- switch (col.name) {
- case 'buttons':
- cell.style.padding = '3px';
- html = '<div>' +
- '&nbsp;&nbsp;' +
- '<a href="javascript:void(0)" class="btn btn-default btn-sm" onclick="editRow(' + r + ')">' +
- '<span class="glyphicon glyphicon-pencil"></span> 留房' +
- '</a>' +
- '</div>';
-
- break;
- case 'saveNum':
- var val = panel.getCellData(r, c);
- if (val == null || val == "") {
- panel.setCellData(r, c, '0', false, false);
- }
- break;
- //关键代码start
- case '抵店时间':
- var val = panel.getCellData(r,4);
- var val1 = formatterDate(val,'yyyy-MM-dd hh:mm:ss');
- if(val!=null && val!=""){
- var hourMin = val1.substring(11, 16);
- console.info("------");
- console.info(hourMin);
- panel.setCellData(r,c,'08:11',true,false);
- }
- break;
- //关键代码end
- }
- }
-
- if (html != cell.innerHTML) {
- cell.innerHTML = html;
- cell.style.padding = '3px';
- }
-
- }
- }
- ;
- editBookRoomView.trackChanges = true;
- var col = editBookRoomFlexGrid.columns.getColumn('roomtypeId');
- col.dataMap = new wijmo.grid.DataMap(msg.attributes.roomTypeList,'codeId','codeNamec');
- }
复制代码 |