I want to set the style attribute to the div tag in dojo 1.8.I have used the following code.
require([
"dojo/request",
"dojo/store/Memory",
"dgrid/OnDemandGrid",
"dojo/store/JsonRest",
"dojo/dom",
"dojo/dom-attr"
], function (request, Memory, OnDemandGrid,JsonRest,dom,domAttr) {
jsonstore = new JsonRest({target: url,idProperty: "srno"});
grid = new OnDemandGrid({
store: jsonstore,
columns: Layout,
minRowsPerPage : 40,
maxRowsPerPage : 40,
keepScrollPosition : true,
loadingMessage: "Loading data...",
noDataMessage: "No results found."
}, "grid");
domAttr.set(dom.byId("grid"),"style","height:250px");
grid.startup();
});
It works fine with firefox.In IE,the below code is not working
domAttr.set(dom.byId("grid"),"style","height:250px");
I put alert and verified.
alert(domAttr.get(dom.byId("grid"),"style")
In firefox ,it is showing height:250px . In IE it is null.
Can someone tell me how to make domAttr.set work in IE as well?
Try dojo/dom-style instead of dom-Attr
require(["dojo/dom-style"], function(domStyle){
domStyle.set("someNode", "width", "100px");
});
Here's the link to the ref : http://dojotoolkit.org/reference-guide/1.8/dojo/dom-style.html#dojo-dom-style
Regards, Miriam
Related
How do you get the project name in Rally?
I'm working with a grid app and all I'm trying to do is include a 'Project' field for the grid view. However, because 'Project' is actually an object, the resulting field is '[object Object]'. So, how is it possible to get the name in string type?
Here's the code from my columnCfgs that deals with making the field.
{
text: 'Project',
dataIndex: this.getContext().getProject().get
},
Try this.getContext().getProject()._refObjectName or this.getContext().getProject().Name
In some cases it is useful to print and explore the object in the console, because it may be that you need to traverse project.data._refObjectName as in this gist, or in your case:
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
items:{ html:'App SDK 2.0 Docs'},
launch: function() {
var currentProject = this.getContext().getProject();
console.log(currentProject);
this.add({
xtype:'container',
html: currentProject.Name
});
}
});
I'm using jquery datatables (datables.net) and I want to multiple columns filtering. My form is prepackaged and prepared. I do not want to use datables input filtering genereator.
any ideas?
you can use fnServerParams here the doc + example
another example :
$(document).ready(function() {
$('#example').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "script/server_showapply.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "nameOfparam", "value": $('#idOfInputForm').val() } );
}
});
});
the server-side :
you should have or something like (depends on server) Request['nameOfparam'] that will have the value of input from your form
for each ajax request of datatable that sends to you, all internal params (sEcho, iTotalRecords... + your custom params here "nameofparam", you can see them in the log network with your browser (ex Chrome F12 > Network > your request > header request > param send)).
Is it help you?
Im using ExtJS 4, and when try print via js console with console.log, the messages not show. I use Firebug to see the js console.
An example:
...
init: function(){
console.log('Controlador cargado.');
this.control({
'abm-grid-usuarios button[action=show]':{
click: function(btn){
console.log('Se clickeo el boton de vista.');
btn.up('abm-grid-usuarios').verInfoUsuario();
}
}
});
}
I load ext-dev.js, any idea ?.
Do you require your controller in app config?
...
Ext.application({
controllers: [
"ControllerName"
],
...
Here is my code:
<script>
require(["dojox/grid/DataGrid", "dojo/store/Memory","dojo/data/ObjectStore", "dojo/store/JsonRest", "dojo/_base/xhr", "dojo/domReady!"],
function(DataGrid, Memory, ObjectStore, JsonRest, xhr){
var gridSimple,
store,
dataStore;
function createGrid(){
gridSimple = new DataGrid({
store: dataStore,
structure: [
{ name: "Name", field: "name", width: "84px" },
{ name: "Last name", field: "lastName", width: "84px" },
{ name: "e-mail", field: "email", width: "120px" }
],
rowsPerPage: 20,
autoHeight:15,
selectionMode: "single"
}, "grid");
gridSimple.startup();
}
function init(){
store = new JsonRest({target: "/users/"});
dataStore = ObjectStore({objectStore: store});
createGrid();
}
init();
});
</script>
<div id="grid">
</div>
I'm getting the first page (The Range header is being sent), but when scrolling down nothing happens, dojo is not sending the next request. Not sure what I'm doing wrong.
I'm on firefox 14.0.1, btw the scroll is really really slow using the mouse wheel. I also tried in chrome, not getting next page, but at least the mouse wheel works just fine.
Dojo version: 1.7.2
The problem was I had to add the next header to my response:
response.addHeader("Content-Range", "items " + from + "-" + to + "/" + total);
I did not know this. It is what they call the "REST Paging standard". http://dojotoolkit.org/reference-guide/1.7/dojo/store/JsonRest.html#id7
On the other hand, firefox is scrolling painfully slow. Not happening in chrome.
Here is the bug report:
http://bugs.dojotoolkit.org/ticket/15487
So, in firefox preferences>Advanced> uncheck "Use smooth scrolling".
I want to show the data from the following API in List :
http://customer.appxtream.com/astro.apps.cms/jsonFeed.action/?service=astroSportsDataService&action=grabJsonText&mimeType=application/json&p1=HighlightNewsList&p2=EURO2012
when I get the data, the Network of Chrome shows me that all elements have been retrieved but List shows only the data from the last item in the API here is my code:
View
Ext.define('astro.view.HighliteNews', {
extend: 'Ext.DataView',
xtype: 'highliteNews',
config:{
title:'xren',
store: 'highliteNewsStoreId',
itemtap: true,
scrollable:'horizontal',
inline:{
wrap:false
},
itemTpl:[
'<div><img src="{imageLink}"/> </div>',
],
},
});
Store
Ext.define('astro.store.HighliteNewsStore',{
extend: 'Ext.data.Store',
xtype:'highliteNewsStore',
config:{
model: 'astro.model.HighliteNewsModel',
autoLoad: true,
storeId: 'highliteNewsStoreId',
proxy:{
type:'ajax',
url :'http://customer.appxtream.com/astro.apps.cms/jsonFeed.action',
extraParams:{
service:'astroSportsDataService',
action:'grabJsonText',
p1:'HighlightNewsList',
p2:'EURO2012',
mimeType:'application/json'
},
reader:{
type:'json',
rootProperty:'cmsHighlightNewsList',
},
},
}
});
Model
Ext.define('astro.model.HighliteNewsModel',{
extend: 'Ext.data.Model',
config:{
fields: ['imageLink'],
}
});
So the network shows that 3 images are sent from API but the List shows ONLY LAST IMAGE.
Please help
I solved the problem guys :) , there is an conflict between Sencha and JsonP, so if you assign a idproperty to your Model, the problem will be sloved :
config:{
idProperty: 'HighliteIdProperty',
fields: ['imageLink'],
}
A few things I would suggest :
Add a listener to the load event of the store
This is just to check that all the data is load in your store.
You can do it in different ways :
In a controller
store.on({
load:function(){
console.log(store.getCount());
}
});
or directly in the store config with the listeners attribute
listeners:{
load:function(store){
console.log(store.getCount());
}
}
Check the DOM
In the Web Inspector / Firebug, check if your items are there or only the last one.
I think you could also try this command in the console :
Ext.DomQuery.select('div[class=x-dataview-item]').length
It will return the number of items in your dataview.
Set a width and height to your image
I also had the same problem with a dynamically loaded dataview. All the picture were there in the DOM but too small to be seen. So I suggest, you give them a CSS class with a defined width and height.
That's all I can think of for now.
Hope this helps
Thanks Arash for this question and answer. We are facing similar problem and found that we didn't have model defined. Defining the model worked in our case. However, it worked while we retrieved playlist from youtube and now while retrieving the list from google spreadsheet. Hope this helps others who are using google spreadsheet.
adjust the height in the config of view......this might be a problem