Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9272495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:53:23+00:00 2026-06-18T15:53:23+00:00

Using Dojo I’ve setup a grid which links to a data store. After the

  • 0

Using Dojo I’ve setup a grid which links to a data store. After the grid load I’ve got a connect function which loops through the rows and sets the row text colour based on the value of a cell. This works fine (code copied below).

var gagrid = new dojox.grid.EnhancedGrid({
query: {
Keyword: '*'
},
store: gastore,
structure: galayout,
escapeHTMLInData: false,
plugins: {
nestedSorting: true
}
},
document.createElement('div'));

dojo.connect(gagrid, 'onStyleRow', this, function(row) {
var item = gagrid.getItem(row.index);

if (item) {
var value = gagrid.store.getValue(item, "Performance", null);
if (value == 3) {
row.customStyles += "color: green;";
} else if (value == 2) {
row.customStyles += "color: red;";
}
}
gagrid.focus.styleRow(row);
gagrid.edit.styleRow(row);
});

I’ve got abit of functionality after the page / grid loads (through user interaction) which uses the store fetch function. It loops through the rows of my grid store and changes the value of a cell depending on the user input. Again, this works fine, the values in the grid are updated correctly. Code below.

gastore.fetch({
query: {Keyword: '*'},
onComplete: function(items, request){
var i;
for (i = 0; i < items.length; i++) {
var item = items[i];
var performance;
if(parseInt(items[i]["Visits"])>=rp)
{
if(parseInt(items[i]["Bounce"])<=rb&&parseInt(items[i]["Time"])>=rmp)
{
performance=3;
}
else
{
performance=2;
}
}
else
{
performance=1;
}
gastore.setValue(item,"Performance",performance);
}
}
});

However, once the values have been updated, the custom styles aren’t applied to the rows instantly. For example, the text colour of a row remains green when it should change to black.

Once the grid has been interacted with (eg. sorting a column) the row colours update to their correct colours.

Is there any way to trigger the correct custom styles for a grid row straight after a store fetch function has been called?

Apologies if my question is abit long winded – just thought I’d try and explain the issue fully 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:53:24+00:00Added an answer on June 18, 2026 at 3:53 pm

    you do not need to loop over the rows ! You can use the “formatter” & the “styles” attribute when defining the layout “galayout”…
    Take a look at that:

    function getExtImg(valueOfColumn) { // Do something with the value...
      return valueOfColumn+'do something with it';
    }
    

    var layout = [[ {‘name’: ‘Ext’, ‘field’: ‘extension’, formatter:
    getExtImg, styles:’padding:0px;’},

    {‘name’: ‘Filename’, ‘field’: ‘documentName’, width: ‘auto’}]];

    // Add this layout to your grid…

    What you specify as the formatter function ist called for every row ! Also the style you specify under the styles attribute.

    I think this will help you out with your problem !

    To be able to change the row style within the formatter, setup a formatter function like this:

    formatter:function(val, rowIdx, cell) {
    classes = compute_classes(val, rowIdx, cell);
    cell.customClasses.push(classes); }

    Source:
    How do you conditionally style a cell in a Dojo data grid?

    As see should easily see, you can add classes to the current row using the push function !

    Lucian

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using DOJO for data grid presentation <div id=grid_log dojoType=dojox.grid.DataGrid store=log structure=window.layout_log queryOptions={deep:true}
I added onclick using dojo to one of my divs dojo.connect(dojo.byId(button1), onclick, function ()
i'm using Dojo 1.6 and trying to update an Html-Store with new data using
I'm using Dojo 1.7 and I have a problem with the dojox/grid/DataGrid and dojox/data/CsvStore
I'm using dojo's event delegation to connect a Tooltip widget to dynamically generated dom
I'm using dojo.xhrPost to sent Ajax Requests The call is wrapped by a function
I am using dojo datagrid to display my data. When the end user edit
I'm using dojo. I've got something like this: <a id=fooBar onclick=foo();bar();>Foo then Bar</a> I
Is it possible to be done using Dojo? this is JQuery code: $(document).ready(function() {
I am trying to POST data using my sub domain using dojo, but dojo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.