Menu
  • HOME
  • TAGS

How to call an event when the dojo dgrid has been rendered completely?

Tag: dojo,dgrid

We are using dojo without pagination and showing all records at once. We need to call a java script method when the entire grid has been rendered completely, so that the grid rows and cell can be used for DOM manipulation.

I am trying following code, but its not working.

aspect.after(grid,"dgrid-refresh-complete",function(){

});

grid.on("dgrid-refresh-complete", function(event){

}); 

Best How To :

dgrid-refresh-complete is implemented specifically in OnDemandList and Pagination. If you're using the SingleQuery mixin instead (as in the tutorial for 0.3 or 0.4), it should be feasible to institute the same kind of event as follows:

var self = this;

// existing code from refresh...

// when(...) (via dojo/when) should only be necessary here for dgrid 0.3
var promise = when(this._trackError(/* existing code from refresh */));

promise.then(function () {
    on.emit(self.domNode, 'dgrid-refresh-complete', {
        bubbles: true,
        cancelable: false,
        grid: self
    });
});

return promise;

So, for example, in 0.3, SingleQuery's refresh method would look like this:

refresh: function () {
    var self = this;

    // First defer to List#refresh to clear the grid's
    // previous content
    this.inherited(arguments);

    if (!this.store) {
        return;
    }

    var promise = when(this._trackError(function () {
        var queryOptions = self.get('queryOptions'),
            results = self.store.query(
                self.query, queryOptions);

        return self.renderArray(
            results, null, queryOptions);
    }));

    promise.then(function () {
        on.emit(self.domNode, 'dgrid-refresh-complete', {
            bubbles: true,
            cancelable: false,
            grid: self
        });
    });

    return promise;
}

dojo FilteringSelect takes time to autocomplete, any hack to autocomplete it faster?

javascript,autocomplete,dojo

Use a searchDelay of propretie's FilteringSelect, the default value is 200ms change it by best value for you. best regards. Hssain....

Intern Async Test

javascript,node.js,dojo,intern

Working solution is below. I had no need for this.async. comapnyCreate.js returns the response and promise from the request. login_test.js runs the test after the promise is fulfilled. (still needs some error handling logic) // login_test.js define([ 'intern!object', 'pages/loginpage', 'runtime/testConfig', 'intern/dojo/node!nconf', 'helpers/companyCreate', 'locators/loginpage', 'locators/companyselectionpage' ], function(registerSuite, LoginPage, conf, nconf, Company)...

Dgrid - Display label for number (i.e. 02 = Cat) I want to display Cat - not the number

javascript,database,dojo,dgrid

You need to use the column formatter function for rendering data. check the jsfiddle over here. Check the examples over here I have taken this example and modified as per your needs. require([ 'dgrid/Grid', 'dojo/domReady!' ], function(Grid) { var data = [ { id: 1, number: 7 }, { id:...

Django - Dojo/Dgrid - how to manage LARGE data sets

mysql,django,dojo,django-rest-framework,dgrid

I don't know how to answer this on the layer between DRF and the database, but as discussed in other SO questions like this one, DRF allows you to limit the amount of data sent with requests via page or offset/limit parameters. Based on the phrasing of your question, it...

Clicking on button using unique button label

java,selenium,selenium-webdriver,dojo

You can locate the element by xpath checking it's text: driver.findElement(By.xpath("//div[. = 'Declaration']")).click(); ...

label name and background color for dropdownButton

css,dojo

I want to display the label name on bottom of the image You can make the elements with class .dijitButtonText display:block which will make it display at the bottom of the image. background color of the dropdown button Are you referring to the red background color on the image? If...

Dojo infinite bounce animation

javascript,css3,dojo

To do that in Dojo you'll have to use dojo/_base/fx to animate the right property. However, you cannot do this in a single animation, because there are multiple keyframes defined. So, you'll have to split it up in the following cases (if you want it similar to the given Codepen):...

Regular expression to check if number is greater than 1

java,validation,dojo

You can do that with the following regular expression: [2-9]|([1-9][0-9]+) This means: a single digit between 2 and 9, or: a digit between 1 and 9 followed by one or more digits. Regular expressions are very powerful, and sometimes people try to use them for everything. This is typically an...

dijit/Tree is not updated when connected to a dojo/store/JsonRest

dynamic,dojo,notify,dijit.tree,jsonreststore

Using jquery instead of dojo was the solution. I found that I could solve in a few hours of learning jquery all problems that occurred when using dojo. This is mostly due to the quality of the documentation of both libraries and also because dojo seems to have too many...

Dojo grid refresh and scroll position

javascript,dojo,dgrid

If you're using OnDemandGrid, it supports a keepScrollPosition property, which you can either define on the grid instance to influence all refresh calls, or pass specifically when calling refresh (e.g. grid.refresh({ keepScrollPosition: true })).

How to Create Dojo Widget using C3

javascript,dojo,widget,c3

I will answer my question : In order to be able to show C3 charts in a dojo Widget, you have to generate charts in the startup() function. If you try to generate chart C3 in another function that come before startup() in the widget life cycle like postCreate() for...

dojo 1.10 How to read text file a user has picked with a file picker

javascript,file-io,dojo

I got this to work. Just sharing the solution for the benefit of others. Technologies used: Jersey 2.x Jackson 2.4.x Jetty 9 Java 8 Dojo 1.10.x Below is the HTML <form> containing the dojox.form.Uploader, allowing the user to pick a file to upload. Note that uploadOnSelect is set to false...

OnDemandGrid column sorting isn't working with dstore/Rest and Django Rest Framework

dgrid,dstore

A quick search through the Django Rest Framework documentation reveals that it defaults to expecting an ordering query parameter to indicate which field should be sorted. The dstore/Request store (inherited by Rest) allows you to indicate the query parameter name that sends sort information, via sortParam. Additionally, it appears that...

Custom Error XPage: Ability for Browser to Load and Execute JS Script Link or Block After Being Loaded On Error

javascript,dojo,xpages,xpages-ssjs

OK, last try. A very interesting one. On your Error.xsp, add the following image: <xp:text escape="true" id="executeOnAjax" tagName="img"> <xp:this.attrs> <xp:attr name="src" value="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="> </xp:attr> <xp:attr name="onload" value="alert('Hello World!');this.parentNode.removeChild(this);"> </xp:attr> </xp:this.attrs> <xp:this.rendered> <![CDATA[#{javascript: var ex = facesContext.getExternalContext(); var...

Why Dojo grid.refresh is making another server call?

javascript,dojo,dojox.grid

In order for the Grid to detect changes in the store without triggering the refresh, you should wrap your JsonRest store with the dojo.store.Observable. Any updates to the store will then be auto updated in the grid. myCacheDataStore = new Cache(myDataStore, new Memory({}); myObservableDataStore = new Observable(myCacheDataStore) You should be...

dojo: using registry.byID returns “undefined”

javascript,dojo,amd

According to the dojo documentation the widget needs besides _TemplatedMixin also _WidgetsInTemplateMixin and inherit from it: But what if we want to have a widget inside of the template, as in: <div class="combinedDateTime"> <div data-dojo-type="dijit/form/DateTextBox"></div> <div data-dojo-type="dijit/form/TimeTextBox"></div> </div> When using this template in a directly extended widget class, you will...

How to fix TypeError: transform(…) is null

dojo,dgrid

Got some assistance from SitePen. Here's the trace Stack - **string.substitute/<()string.js (line 147) string.substitute()string.js (line 141) ._updatePaginationStatus()Pagination.js (line 395) .gotoPage/ return transform(value, key).toString(); instrum...tion.js (line 20)** The Pagination was failing - potentially trying to pull data before it was actually there. "Code is trying to do a string.substitute call, but...

Content-Range configuration for Django Rest Pagination

dojo,pagination,django-rest-framework,http-content-range

If you are talking about providing Content-Range in the response, I mentioned in an answer to another SO question (which I believe may also have originated from your team?) that there is one alternative to this header: if your response format is an object (not just an array of items),...

How to call an event when the dojo dgrid has been rendered completely?

dojo,dgrid

dgrid-refresh-complete is implemented specifically in OnDemandList and Pagination. If you're using the SingleQuery mixin instead (as in the tutorial for 0.3 or 0.4), it should be feasible to institute the same kind of event as follows: var self = this; // existing code from refresh... // when(...) (via dojo/when) should...

dijit/form/DateTextBox not correctly parsed

javascript,date,dojo

You have used dijit/registry to get hold of the domNode which is not correct. dijit/registry will search for dojo widgets which are different from domNode objects. dojo/dom module should be used for searching domNodes by id's. i.e require(["dojo/dom"], function(dom){ dom.byId('domId') } ); Have a look over here for detailed explanation...

Dojo fallbacks for IE9

javascript,css3,dojo

You should look at http://dojotoolkit.org/reference-guide/1.10/dojo/fx.html It is all about animations......

Calling a function from outside of require which is written inside of require in dojo

javascript,html,asynchronous,dojo

Well, it's indeed a scope issue. You can solve it in various ways. One of them is to put outerFunction() inside the require() block like you mentioned. However, if you call that function from somewhere else, you might encounter a problem. For a breadcrumb link (you mentioned) you could use...

How to call custom js function on scroll in Dojo OnDemandGrid?

javascript,dojo,grid

There isn't anything exposed per se for this, but you should be able to aspect after the _processScroll method, which is what is called in response to the grid's viewport scrolling. The _processScroll method itself determines whether more data needs to be loaded. If it doesn't need to load anything,...

dgrid 'Object doesn't support this action; when attempting to render columns

dojo,dgrid

There was an interference with another package that I was pulling in causing the type of grid to be incorrect.

How can I return the value of a deferred method in javascript

javascript,dojo,deferred,arcgis-js-api

In your example, newPoint will only actually set after the return statement is already processed, so it's undefined when that line runs. Generally, if something within your function's logic is asynchronous, your function in itself will need to be asynchronous in nature as well. Typically in these cases it is...

How can I use lodash in dojo?

dojo,lodash

Have you tried the AMD branch? https://github.com/lodash/lodash/tree/3.9.3-amd You should then be able to add it to your packages, and require it in like any other module. Edit: It worked locally by adding lodash to the packages to my dojoConfig object var dojoConfig = { async: true, baseUrl: '.', packages: [...

Dgrid - Firefox breaks while trying to load large data set in dgrid

javascript,firefox,dojo,dgrid,broken-pipe

I don't really know what is wrong per sey, but I would imagine that you are having memory issues. I was using Gridx with about 15,000 rows and had lots of problems with memory until I implemented the JSONRest store. For so many rows, I would strongly recommend to use...

Custom Validation on HTML Number Input Misbehaving

javascript,html,dojo,cross-browser

I think that's the default behavior of number input type, but I'm not sure. It's logical to think the input should not let the user put anything that is not a number, so it clears all the value before you can fire your keyup event. So to keep the last...

dojo xhrPost progress (callback) event listener?

javascript,ajax,dojo

The new dojo/request module supports progress events. It will automatically call the new dojo/xhr module on browser platforms. Don't confuse these API's with the old, deprecated, counterparts. There are key differences in the way the modules are included and called: Different files must be included in a different manner (AMD...

Dgrid and Django Rest Framework (JsonRest)

python,django,dojo,dgrid,jsonreststore

This question has begun to morph, so I've formatted my answer a bit to try to match so it's still somewhat cohesive. Problem 1: dgrid version vs. store API in use dgrid 0.4 interfaces with dstore stores, not dojo/store, which is why you're ending up with no data displayed. dstore/Rest...

color dgrid cell based on cell value

javascript,css,dojo,dgrid

Generally, the simplest way to do this would be to use renderCell, which gives you direct access to the cell: Priority: { label: "Priority", renderCell: function (object, value, cell) { cell.className += " " + value; return document.createTextNode(value); } } Note that renderCell can return a node to be placed...

dojo Grid renderCell Textarea

dojo,textarea

Initially, I notice a few issues which might be causing this problem. Try the following instead: // Dijit widgets should not be mixed into the grid with declare. // If you're using 0.3, editor should not be mixed in either, // intended to be applied to specific columns (in 0.4...

DGRID - give numeric value for multiple Characters in field

javascript,dojo,dgrid

Altered. function XXXXInfoFormatter(item) { var length = item.length; var i; var Wrongs = []; // Scan chars from right to left. for (i = length - 1; i >= 0; --i) { if ('!' === item[i]) { // If its a '!', put it id from Right to the Wrong...

dojo.exists fails with IE11

javascript,dojo,xpages,internet-explorer-11,lotus-domino

Using dojo.exists for this isn't very appropriate, given that btnUpload is technically just a DOM ID, and not an actual object in the global scope. if (document.getElementById('btnUpload')) would seem to be far more appropriate in this case. When a global reference is encountered that doesn't match an actual global variable,...

dstore ( dojo ) event (add) misfiring on collection

javascript,dojo,dstore

Collections typically inherit the add/put/remove methods from the store they originated from. When dstore fires events, all collections related to the store are notified. This is largely for consistency's sake, since in cases where the store is server-based, it would be impossible to determine purely client-side whether each event is...

How to save a json file locally with dojo toolkit

javascript,android,json,eclipse,dojo

Why use dojo? You can use javascript and HTML5

Best way to handle multi-valued fields as a view/grid

dojo,xpages

This TableWalker may provide what you want http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Tutorial-Introduction-to-XPages-Exercise-23 It was created when XPages was all very new, so it's SSJS rather than Java. But if you're comfortable wiith Java, converting it probably won't be a challenge....

dojox.layout.TableContainer using div instead of table element

dojo

I have created a jsfiddle over here with TableContainer layout inside a ContentPane. The JS part: require(["dojo/parser","dijit/layout/ContentPane","dojox/layout/TableContainer", "dijit/form/TextBox","dojo/domReady!"], function (parser, ContentPane, TableContainer, TextBox ) { var myCP = new ContentPane({ style:"height:125px" }, "putWidgetHere"); // Add the custom class "labelsAndValues" var programmatic = new TableContainer( { cols: 2, customClass:"labelsAndValues", "labelWidth": "150"...

Change CSS class of a
using dojo

javascript,html,css,dojo,frontend

The data-dojo-attach-point attribute works when you are creating a template based widget. Most probably the this is not referring to the right object. Anyway here is a jsfiddle of dom-class which works. require( [ 'dojo/dom', 'dojo/dom-class', 'dojo/domReady!' ], function(dom, domClass) { function swapColor( ){ if (value == 0){ domClass.remove('node', 'red');...

dojo.require not loading in recursive order

javascript,dojo,cross-domain

Generally speaking, dependencies at the same "level" (e.g. two dojo.require calls in the same module) aren't expected to be order-dependent. If module2 really depends on module1 having been loaded, then module2 itself should contain a require call for module1, which would accurately express a recursive dependency. I would advise against...