Comments (1)
I don't think you can make this work with renderSwitchStatusOptions
. The problem is, that the render information (what picture to show etc.) is generated in PHP and stored in an extra field with the ending _ro
(e.g. visible_on_page_ro
). When you click "Save" in the update-window this information is lost.
You'd have to make an AJAX-call to get the current render information.
The easiest solution is probably to code a custom renderer with hard-coded render options.
- Create a file
grid.config.inc.php
incore/components/somepackagename/migxconfigs/grid
. - Add code for your custom renderer and handler function to this file. Something like this may work:
<?php
$my_img = '<a href="#" ><img class="controlBtn {3} {4} {5}" src="'.$base_url.'{0}" alt="{1}" title="{2}"></a>';
$renderer['this.myRenderSwitchStatusOptions'] = "
myRenderSwitchStatusOptions : function(val, md, rec, row, col, s) {
var column = this.getColumnModel().getColumnAt(col);
var renderImage, altText, handler, classname;
if (val == '1'){
renderImage = 'assets/img/icons/yes.png';
altText = 'yes';
} else {
renderImage = 'assets/img/icons/no.png';
altText = 'no';
}
handler = 'this.myHandleColumnSwitch';
classname = '';
return String.format('{$my_img}', renderImage, altText, altText, classname, handler, column.dataIndex);
}
";
$gridfunctions['this.myHandleColumnSwitch'] = "
myHandleColumnSwitch: function(n,e,col) {
this.selected_records = this.getSelectionModel().getSelections();
var old_val = this.selected_records[0].get(col);
var new_val;
if (old_val == '1'){
new_val = '';
} else {
new_val = '1';
}
this.updateSelected({dataIndex: col}, new_val);
}
";
?>
- In your config in the tab "MIGXdb-Settings" set the field "Package" to
somepackagename
. - In the tab "Columns" select your custom renderer ("this.myRenderSwitchStatusOptions") from the list.
- In the tab "Handlers" check the checkbox for the custom handler "this.myHandleColumnSwitch".
from migx.
Related Issues (20)
- parseInputOptions() calls deprecated mysql_fetch_row() HOT 1
- Hidden Checkbox in Tabs HOT 2
- migxResourceMediaPath creates empty folders HOT 5
- Problem getting service fileHandler HOT 5
- error phpthumbon HOT 1
- MIGX-3.0.2-beta1 not create a table 'tasks' from mysql.schema.xml HOT 2
- MIGX 3.0.2 show warning "media_source_id" when use "this.renderChunk" HOT 2
- Textareas not rendering properly after update
- @EVAL binding not working after update HOT 2
- Console error, variable undefined in PHP 8 HOT 1
- no text on toggletrash button in resource tv migxdb HOT 1
- Problem with TinyMCE, drop-down menu's are behind window HOT 2
- Handler this.handleColumnSwitch doesn't work for MIGX TVs in MODX 3
- Column buttons don't work on migx-3.0.2-beta1, MODX 3.0.4 HOT 2
- Setting "max MIGX records" can be bypassed by using duplication
- MODX, MIGX and Polylang Cyrillic? HOT 3
- Various Deprecated Warnings using 3.0.2-beta1 on PHP 8 in MODX 3.0.X HOT 2
- Unclear logic for displaying the lexicon for empty items in grid
- Add "NOT IN" filter in filterItems
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 migx.