Would anyone let me know how to refresh a grid depending on your selection from another grid. I'm looking at the example at
http://archive.dojotoolkit.org/nightly/checkout/dojox/data/demos/demo_QueryReadStore_grid.html
Is there is any way that the second grid can be updated once you click on any row in the first one. For example Assume that the first table has only the state names and the second one has the capitals. When I click on the State on the first table I only want to see the capital for that state at the second grid.
Please let me know if you have an answer for me.
Thanks,
I would do it this way, using refresh grid to change the store, and the layout of the other grid if necessary using the text value.
grid.onCellClick = function(e) {
refreshGrid(e.cellNode.innerHTML);
};
Related
I am trying to make the table component with the button inside the table column in CDE Pentaho. How can it be achieved?
I guess it will need some work.
In the Draw function of your table, you may put some javascript to manipulate the DOM and add your button : as far as I remember, the draw function receives a parameter that is a structure with the column and row index of the current cell.
Try first this code in the draw function :
function(paramdraw) {
console.log(paramdraw);
}
and look for the content of paramdraw iin the console.
Maybe there is a better way to do it...
What we do here usually is something like editing the query on the datasource with a column that output the HTML code for a button.
SELECT
ID,
NAME,
concat('<input type="button" onclick="alert(',ID,')">click me</input>') as button
FROM
foo
WHERE
bar='bar';
That should display a button. If you are not using a query as datasource, but a transformation the idea is the same. Just make the output contains a string that when interpreted by the browser is a button.
Hope it helps. =)
Is there currently a way to highlight a row in a table? For example, I would like to list a table of entries and be able to highlight a row and click Process. I can't find any examples of this online - I'm sure there's a way though, right?
Highlighting the row could be done based on a radio button - a user selects the radio button for the row they want to update, and then click Process or whichever button they want, and that action would be performed for that row.
Any help on where I should look (or just a quick example) would be greatly appreciated!
If you're going to use a radio button, try add a jQuery action on it.
Something like:
onClick: ((html jQuery: #tableRowId) toggleClass: 'highlight')
Then have CSS that'll highlight the row
.hightlight {
background-color:light-yellow
}
If you need a more extensive example, let me know.
I am a dojo newbie so please forgive my ignorance. I have a dojox.mobile.EdgeToEdgeDataList which is dyanmically populated using ItemFileReadStore
var jobStore = new dojo.data.ItemFileReadStore({url: "items", clearOnClose: true});;
...
<ul dojoType="dojox.mobile.EdgeToEdgeDataList" id="execlist" store="jobStore" query=" {state: 'active'}"></ul>
On clicking any of these dynamically generated rows I want to display detailed information about the item referenced in the row. In order to do that I need to know which row was clicked and extract the label from that row
I tried the following:
dojo.query("#execList li").connect("onclick", function(){...});
but that works only for the case where the rows already exist at the dojo.ready time.
Any idea how I could do this?
Thanks in advance!
NJ
I was able to get solve my problem by updating the contents returned by ItemFileReadStore to include a onclick(mymethod(rowid)) element in each row. This inserted the onclick event on each list item within the EdgeToEdgeDataList allowing me to identify which row was clicked.
Thanks
NJ
I have a datagrid that uses a data structure like:
[
{
name: "test"
sub_things: [ { name: "blah" }]
}
]
Each row will have varying numbers of sub things and I an trying to add them as subrows in a row in the datagrid by adding another datagrid in the cell formatter, but cant seem to get it added. How would I acheive this? Or is there a better way?
What you are looking for exists! Check it out: subgrids!
Putting datagrids in datagrids, even if you can figure out how to do it sounds like a recipe for slowing down the browser or making it explode.
You could consider a few things:
Make this into a two step process. The first datagrid just has the name "test" and maybe a brief summary of sub_things. When you click on a row, it opens a new grid on another tab or maybe on the right side which contains the sub things just for that item.
You could use multi row layout of the datagrid like explained on this page (scroll down a bit for the multirow examples)
http://www.sitepen.com/blog/2008/07/14/dojo-12-grid/
You could have a combox box with a type ahead suggest of the main items and when one item is selected, then render a datagrid below it with the sub items.
By nesting grids in grids you are going to create a usability nightmare, so I would really recommend focusing on how to limit the data shown to the user and keep it as simple as possible.
I have a question, I have a combo box, which when changed fills the data grid. Now Wen I change the Tab and come back to same tab again(one containing the combo box)..the value of combo box remains there, however the grid gets empty. I need this data to be maintained till the user selects another value from drop down.How can this be done???
Any suggestions would be appreciated.
Some of the possible reasons :
There is a MyDataGrid.clear somewhere
The DataSource used to fill the grid is somewhere cleared.
If you use a DataSet, your DataTable is somewhere truncated.
If you use a BindingSource as your DataSource, maybe somewhere else you're using the same BindingSource, which empties the grid.
I would recommend you to put a braekpoint on your Combobox change value event to see if it's not called with a wrong value somewhere else.
And I would add a spy to check your DataGrid (the number of lines for example) to precisely know where it happens by executing my code step by step.
Hope this helps !