53934

use of onCellWidgetCreated in Dojo Gridx (to add button to cell)

Question:

I try to add a button to the last column of my Gridx, however, the button is not shown and above the other table data the grid just says "loading...".

<a href="https://i.stack.imgur.com/XhF2p.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/XhF2p.png" data-original="https://i.stack.imgur.com/XhF2p.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Cell Widget is required and declared, widgetInCell is set and onCellWidgetCreated function added. When replacing the onCellWidgetCreated function with alert, an alert message for each row is shown and the "loading..." disappears. My feeling is that the onCellWidgetCreated function is wrong?

My code looks like the following and when comparing it against some examples on the Gridx website I cannot find the problem.

require([ "gridx/Grid", "gridx/core/model/cache/Sync", "dojo/store/Memory", "dojo/domReady!", "gridx/modules/CellWidget", "dijit/form/Button" ], function(Grid, Cache, Memory,Button,CellWidget,domConstruct){ var store = new Memory({ idProperty:"CategoryID", data: jsondata }); var grid = new Grid({ id:"gridId", store: store, cacheClass: Cache, structure: [ { id: "0", field: "CategoryID", name: "Kategorie (ID)", width: "100px" }, { id: "1", field: "CategoryName", name: "Kategoriename" }, { id: "2", field: "Attributes", name: "Attribute" }, { id: "3", field: "Actions", name: "Aktion", widgetsInCell: true, onCellWidgetCreated: function(cellWidget, column){ var btn = new Button({ label: "Click me!" }); btn.placeAt(cellWidget.domNode); } } ], modules: [ CellWidget ] }); grid.placeAt("aGrid"); grid.startup(); } );

Answer1:

I came across anotheer problem with VirtualVScrolling and found out that this was due to a defective gridx css file which contained a custom layout. When using the standard css file, "onCellWidgetCreated" worked for me as well.

Recommend

  • GridBagLayout fix space set by weight x/y
  • Select an element in jquery with two attribiutes
  • “append” text for JTextField
  • Hilbert Transform (Analytical Signal) using Apple's Accelerate Framework?
  • Explode string except where surrounded by parentheses?
  • Firefox + Selenium in python: How to interactively get an element html?
  • FParsec: how to combine parsers so that they will be matched in arbitrary order
  • New BFC “clearing” floating boxes
  • GridBagLayout padding
  • KeyDown not picking up 'Return' key C#
  • Compare variables PHP
  • SharePoint Designer 2010 - Determine if today's date is within x days of a start date column us
  • Context menu disappears when opened with Key.App
  • rails - convert DateTime to UTC before saving to server
  • Add a div to replace Video after Video Plays Through
  • SAVE attribute needed for Fortran variables when only the C_LOC address is returned to a C program?
  • rspec simple example getting error on request variable in integration test
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • How to attach a node.js readable stream to a Sendgrid email?
  • Typescript - Unable to get 'import' statement to function
  • Meteor: Do Something On Email Verification Confirmation
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Is there any way to access browser form field suggestions from JavaScript?
  • Spray.io: When (not) to use non-blocking route handling?
  • Join two tables and save into third-sql
  • Where to put my custom functions in Wordpress?
  • How to model a transition system with SPIN
  • Javascript + PHP Encryption with pidCrypt
  • ORA-29908: missing primary invocation for ancillary operator
  • RestKit - RKRequestDelegate does not exist
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • WPF Applying a trigger on binding failure
  • Qt: Run a script BEFORE make
  • apache spark aggregate function using min value
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is there any way to bind data to data.frame by some index?
  • How can i traverse a binary tree from right to left in java?
  • Converting MP3 duration time
  • Conditional In-Line CSS for IE and Others?