I have a KendoUI grid bounded to a Json array coming in through a rest service. Json array, along with other data, contains a nested array of a list of image URLs to display. This list of URLs is not fixed, i.e. Json sub array can contain from 0 to any number of image URLs.
[{"Team":"KendoUI",
"Address":"132, 64th St N, Jacksonville, FL,33445",
"BaseDocs":[
{"BaseFileName":"Adam.png",
"City":"Ocala",
"XFileDesc":"Test PIC",
"XFileName":"D:\\Adam.png"},
{"BaseFileName":"Eve.JPG",
"City":"Houston",
"XFileDesc":"Kice Picture",
"XFileName":"D:\\Eve.JPG"},
{"BaseFileName":"Kelly.png",
"City":"Port Ritchie",
"XFileDesc":"Test PIC",
"XFileName":"D:\\Kelly.png"}
],
"Department":"HR"}]
In term of functionality, I have a command button inside the grid, which when pressed, should show up all images for that record.
I've bounded the nested array to a column however, I'm getting nothing but text showing JavaScript object.
How can I bound the button to multiple image URLs in this case?
Related
I'm using RadListView and intercepting onItemLoading event.
Within that event, can I reference individual view elements inside the itemTemplate.
I see args.view._subViews - but I was wondering whether i could find element by name or something else. I assume id would not work because each item would have the same id.
You are correct getting by Id would only return the first one. However, if you have the reference to the ListView child group; using id will work to get the element out of a group.
Now if you use my NativeScript-Dom plugin then it is very simple; you can do:
var elements = RadListView.getElementsByClassName('someClass'); or RadListView.getElementsByTagName('Label'); or the newer functionality `
RadListView.runAgainstTagNames('Label', function(element) {
/* do something with this element */
});
And work with an array of elements that match your criteria.
Please also note that in a ListView that not all elements are preset; ListViews only have as many elements are needed to fill the ListView + 1 typically; so even if you have 2,000 items in the list view; you might only have 10 actual child ListView groups of elements. So when you did a GetElementsByTagNames('Label') you would only get 10 of them...
I want to use JXA to automate some updating of Numbers spreadsheets. For example, copying a range of cells from one spreadsheet to another one with a different structure.
At this point, I'm just testing a simple program to set or read the value of a cell and I can't get this to work.
When I try to set a value I get "Error -1700: Can't convert types." and when I try to read a value I get back a [object ObjectSpecifier] rather than a text or number value.
Here's an example of the code:
Numbers = Application('Numbers')
Numbers.activate()
delay(1)
doc = Numbers.open(Path('/Users/username/Desktop/Test.numbers'))
currentSheet = doc.Sheets[0]
currentTable = currentSheet.Tables[0]
console.log(currentTable['name'])
console.log(currentTable.cell[1][1])
currentTable.cell[1][1].set(77)
When I run this, I get and output of [object ObjectSpecifier] for the two console.logs and then an error -1700: Can't convert types when it tries to set a cell.
I've tried several other variations of accessing or setting properties but can't get it to work.
Thanks in advance,
Dave
Here is a script that sets and gets a cell's value and then sets a different cell's value in the same table:
// Open Numbers document (no activate or delay is needed)
var Numbers = Application("Numbers")
var path = Path("/path/to/spreadsheet.numbers")
var doc = Numbers.open(path)
// Access the first table of the first sheet of the document
// Note:
// .sheets and .tables (lowercase plural) are used when accessing elements
// .Sheet and .Table (capitalized singular) are used when creating new elements
var sheet = doc.sheets[0]
var table = sheet.tables[0]
// Access the cell named "A1"
var cell = table.cells["A1"]
// Set the cell's value
cell.value = 20
// Get the cell's value
var cellValue = cell.value()
// Set that value in a different cell
table.cells["B2"].value = cellValue
Check out the Numbers scripting dictionary (with JavaScript selected as the language) to see classes and their properties and elements. The elements section will show you the names of elements (e.g. the Document class contains sheets, the Sheet class contains tables, and so on). To open the scripting dictionary, in Script Editor's menu bar, choose Window > Library, and then select Numbers in the library window.
In regards to the logging you were seeing - I recommend using a function similar to this:
function prettyLog(object) {
console.log(Automation.getDisplayString(object))
}
Automation.getDisplayString gives you a "pretty print" version of any object you pass to it. You can then use that for better diagnostic logging.
I use jqGrid v4.4.5 and I want to create it with dynamic columns.
It is filled by "jqGridHandler.ashx" file .
I want send all information(column name,data,...) by JSON .
I search for it in Google but can not find a good answer.
By Click on each node(child) change whole grid(actions and columns...).For example by click on node3 the grid has three columns 'A' and 'B' and 'actions' but by click on node2 grid has columns 'C' and 'D' and 'actions'.
One can use jqGrid to create many different grids, tree grids, subgrids and so on. It's very important to understand whether you want to display grid with 10 rows or with 100000 rows. If you have 100000 rows (or some other large number of rows) you will have to implement server side paging and sorting of data. So if the user would click on the "next page" button the next rows should be loaded from the server. Why you would need to send all colModel data on paging or sorting? So you should clear understand that in server side scenario one need create all structures of grid only once and then one need refresh only the body of grid. So it would be bad choice to send all information (column name, column model, data,... at once).
Only if you have some hundreds or some thousand of rows in the grid and you can use loadonce: true option them you can load once all information (column name, column model, data, ...) per separate jQuery.ajax call and then create jqGrid with datatype: "local" and using data parameter which contains all grid data.
UPDATED: If you need change
// in the example below the grid with id="list" will be created
// with column having name: "c4" in colModel
var $grid = $("#list"), columnName = "c4";
...
var $colHeader = $("#jqgh_" + $.jgrid.jqID($grid[0].id) + "_" + $.jgrid.jqID(columnName)),
$sortingIcons = $colHeader.find(">span.s-ico");
// change the text displayed in the column
$taxHeader.text("New header text");
// append sorting icons to the new text
$taxHeader.append($sortingIcons);
Before your initialize the jqGrid you will need to have the information for your colNames and colModel properties of the jqGrid.
So in short, you will request the information from your server, once you have successfully retrieved that information you can then build the jqGrid and then the jqGrid can go and fetch it's data.
The following post has some example code on the client side:
jqGrid and dynamic column binding
I have view books/browse which uses 3 elements (those elements don't use any requestAction, they just depend on variables set in books/browse controller. Each element is enclosed in separate div with id of this element. Now I want to have a link which will refresh with ajax 2 of 3 elements. For now I have something like this (this is in books/browse view):
echo $this->Js->link('Page 2', array('page' => 2), array('update' => '#element_id'));
and in books/browse controller I have:
...
$this->set('books', $books);
$this->set('author_keywords',$author_keywords);
$this->set('title_keywords',$title_keywords);
$this->set('languages',$languages);
$this->set('language_id',$language_id);
$this->set('limit',$limit);
$this->set('category_id',$category_id);
if ($this->RequestHandler->isAjax())
{
$this->autoRender = false;
$this->layout = 'ajax';
$this->render('/elements/element1');
}
return;
And this works fine, the element in div 'element_id' is refreshed with proper contents of elements/element1
Now I want to update 2 element in separate divs in a single request. So maybe is there option to pass to link 2 divs which should be updated - but how then use the controller to render two elements in those 2 divs?
--edit
the purpose of this is to ommit refreshing one element on the page as its database queries and rendering are slow, and it doesnt change...
-- edit
Okay I have an idea on how to do it - in controller I have to render two elements and save html returned by those elements in two variables, then return ajax data like some array with 2 variables containing those elements html. Then I have to use JS to update two divs... But how to do it in controller?
I am developing a game similar to geochallenge game in facebook. here i am unable to decide whether i should use Image buttons/Grid view/Image view or some other else....?
please can any one suggest in this regard...
My requirement is
I should store some number of images. And at particular time I should randomly display three distinct images, and these images will be replaced by other images when any of those images is clicked. The the images should not be repeated.
can you help me please.
Now i am using Image button concept but the images are repeating in three image buttons. But i should get distinct images on each image button.
after a long struggle I was able to get a solution. Here's what I did.
I have a flags array "Country[]" and three Image Buttons declared as ImageButton array bt[]={id1,id2,id3};, which I use with the following code:
public void randomDisplay()
{
L=Country.length;
for(int i=0; i<3;i++)
{
int random=rand.nextInt(L-1);
if(i==0)
id1=Country[random];
if(i==1)
id2=Country[random];
if(i==2)
id3=Country[random];
id=getResources().getIdentifier(Country[random], "drawable", getPackageName());
bt[i].setImageResource(id);
String temp=Country[L-1];
Country[L-1]=Country[random];
Country[random]=temp;
L=L-1;
}
}
The above code will shift one country name to the end of the country array at each repetition, and decrements the country array length. This will avoid the duplicate names on ImageButtons. If you have any question please let me know...