1
Suggest new features / Re: Drag drop ability to drag from an entire row or a cell and better drop indicator
« on: October 21, 2024, 05:32:24 pm »
Is there any update in new release?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
filter: {
crules: [{condition: 'range'}],
gridOptions: {
stripeRows: false,
filterModel: {header: false}
},
options: [
{"": lang.allTxt},
{"0:1": "days <= 1"},
{"1:7": "1 < days <= 7"},
{"7:14": "7 < days <= 14"},
{"14:21": "14 < days <= 21"},
{"21:30": "21 < days <= 30"}
],
//override range compare.
conditions: {
range: {
compare: function (cellData, val) {
console.log("cellData", cellData, "val", val);
return true;
}
}
}
}
eachCell:function(cell, ci, ri, column, rowData){
// get the orininal cell value;
cell["value"] = rowData[ column["dataIndx"] ];
// set date format to create date , out date, and return date
if([ "OUT_DATE", "RETURN_DATE"].includes(cell.dataIndx))
{
var date = empty(cell["value"]) ? false : moment(cell["value"]),
days = date ? date.diff("1900/01/01", "days")+2 : false,
converted = date ? days + ((date.second() + (date.minute()*60) + (date.hour()*60*60)) / 86400) : false;
cell["format"] = "dd/mm/yyy";
if(converted)
cell.value = converted;
}
}
$("#tree").pqGrid({
dataModel: {data: []},
colModel : [
{dataIndx:"TITLE", title:lang.itemTxt, halign:"center", sortable:false,
filter:{crules:[{condition: 'contain'}], style:"text-align:left;"},
render:function(ui){
return that.render_node_txt(ui);
}
},
....
],
numberCell: {show: false}, // The left number cell index column off
animModel: {on: true, duration: 290}, // Turn on animation
stripeRows: true, // Show stripes
menuIcon: false,
scrollModel:{autoFit:true}, // show scroll
flex: {on:true}, // Width of headers auto fit
width: "100%",
dragColumns: {enabled:false},
// DISPLAY
hoverMode: "row", // on hover change color effect
showTitle: false, // Hide table title
wrap: false, // Cell content on one line
hwrap: false, // header content on one line
showTop: false, // Hide top (including col move icons)
selectionModel: {type:"row", mode:"single", column:false, all:false}, // Select rows
editable: false, // not able to edit
sortable: false,
//virtualWin: true, // Faster rendering - Causes a crash in TreeGrid
rowInit: function(ui){
var cls = "";
// Is there anything left to assign
if(
intval(ui.rowData["TYPE"])!==0 && intval(ui.rowData["TYPE"])!==5 &&
typeof(that.data.assigned)==="object" && !empty(ui.rowData["item_index"]) && typeof(that.data.assigned[ ui.rowData["item_index"] ])!=="undefined"
)
{
// Have all items been assigned
if(floatval(that.data.assigned[ ui.rowData["item_index"] ]) >= floatval(ui.rowData["QUANTITY"]))
cls = "silvertext";
// Has every ordered item been checked out (none assigned, but all out)
else if(
typeof(that.data.quantities)==="object" && !empty(ui.rowData["index"]) && typeof(that.data.quantities[ ui.rowData["index"] ])!=="undefined" &&
floatval(that.data.quantities[ ui.rowData["index"] ]["remain"]) <= 0
)
cls = "silvertext";
}
// Return a class
return {
cls: cls
};
},
// filter colums
filterModel: {
on: true,
header: true,
menuIcon: false
},
// Tree
treeModel: {
dataIndx: "TITLE",
id: "item_index",
filterShowChildren: true,
icons: true,
render: function(ui){
// If the item is an autopull, the icon is grey
var autopull = empty(ui.rowData["AUTOPULL"]) ? "" : " silvertext";
switch(intval(ui.rowData["TYPE"])) { // 4 = labour & 6=calculated (both not used here)
case 1: // Consumable
return {iconCls: "ui-icon-cart-b"+autopull};
break;
case 2: // Stock
return {iconCls: "ui-icon-gear"+autopull};
break;
case 3: // Custom
return {iconCls: "ui-icon-radio-off"+autopull};
break;
case 4: // Labour (not used)
return {iconCls: "ui-icon-person"+autopull};
break;
case 5: // Comment
return {iconCls: "ui-icon-comment"+autopull};
break;
case 6: // Calculated (not used)
return {iconCls: "ui-icon-calculator-b"+autopull};
break;
}
}
}
});
},