Comments (8)
Is there any way to get selected rows in Datatable?
But how to get row Ids, that is selected?
What is the Event to capture selected rows?
Thanks in Advance…
from datatable.
@hetal1110 you can get selected rows of report having checkbox as mentioned below:
onload: function() {
// add a button to report
frappe.query_report.page.add_inner_button(__("Get Selected"), function() {
var selected_rows = [];
$('.dt-scrollable').find(":input[type=checkbox]").each((idx, row) => {
if(row.checked){
console.log("*** selected row id : " + idx);
selected_rows.push(frappe.query_report.data[idx]);
}
});
});
},
from datatable.
Hi @melBoh, thank you very much. I think it's working real well as I have used it to enabled a feature of editing inline and update it in the database. I wonder why it's still not merged to the repository.
If I make the changes on my own, how to prevent the changes be override with next frappe version updates.
from datatable.
why this is still open? Can a PR be made for this?
from datatable.
Actually, I found using the setValue
function when setting the datatable's getEditor
return object provided the same functionality.
For example (using Frappe Controls)
getEditor: function(colIndex, rowIndex, value, parent, column, row, data) {
// colIndex, rowIndex of the cell being edited
// value: value of cell before edit
// parent: edit container (use this to append your own custom control)
// column: the column object of editing cell
// row: the row of editing cell
// data: array of all rows
const control = frappe.ui.form.make_control({
parent: parent,
df: {
label: '',
fieldname: doctype,
fieldtype: 'Link',
options: doctype
},
render_input: true,
only_input: true,
});
let oldValue = '';
return {
// called when cell is being edited
initValue(value) {
control.input.focus();
control.input.value = value;
oldValue = value;
},
// called when cell value is set
setValue(newValue) {
// ----------- Do whatever is needed here.
control.input.value = newValue;
},
// value to show in cell
getValue() {
return control.input.value;
}
}
}
from datatable.
I've hit a strange roadblock.
Inline editing works in Report Builder, but calculated fields are not possible.
Calculated fields are possible in script editor, but inline editing is not possible.
from datatable.
I've hit a strange roadblock.
Inline editing works in Report Builder, but calculated fields are not possible.
Calculated fields are possible in script editor, but inline editing is not possible.
Editing a calculated field goes against their purpose. I would make it whatever type it should be and do the calculation manually. Alternatively, you can make a hidden calculation field and copy the value over to the editable field.
from datatable.
I've hit a strange roadblock.
Inline editing works in Report Builder, but calculated fields are not possible.
Calculated fields are possible in script editor, but inline editing is not possible.Editing a calculated field goes against their purpose. I would make it whatever type it should be and do the calculation manually. Alternatively, you can make a hidden calculation field and copy the value over to the editable field.
Obviously! I wouldn't want a calculated field to be editable. Instead, I have a report where both type of columns are needed - one for calculated and another for inline editing.
from datatable.
Related Issues (20)
- Broken cell layout
- bug: Not Equals filter not working
- bug: Scroll disappears with no data making column filter inaccessible
- Crash on first example HOT 1
- feat: string exact match filter
- datatable.refresh() takes more than 10x as long to run than rebuilding the table from scratch
- On RTL View, Resizing columns work in reverse
- Add option to provide translated labels HOT 1
- Add or append by columns
- fix: allow resizing datatable serial number column
- Does this have a pagination component? HOT 2
- sticky columns on report view HOT 5
- feat: string not match filter
- How to disable dragging column? HOT 1
- I want to add a row with one column.
- Usability enhancements to the reports framework HOT 2
- incorrect arg for formatter during filters
- row index remains checked after refreshing datatable
- Sortable property on Column doesn't disable sorting options on UI HOT 2
- General Ledger view : column width resize behaves erratic.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatable.