dhtmlx grid smartrender not work normally after sorting with splitAt mode - grid

I use split mode and smartrender in dhtmlx grid. After I sort rows, rendered rows disappear and never come out on the right side, like the following picture.
after sorting, rows on right side could not be rendered anymore(click here to view the picture)
It's strange, rows on the left could be rendered when I scrolling on both sides.But rows on right side could not be rendered.
Anyone helps?
Thanks!
code structure:
var grid = new dhtmlXGridObject('#container');
grid.setImagePath("./bower_components/dhtmlxSuitePro/4.1.1/codebase/imgs/");
grid.enableTreeCellEdit(false);
grid.setHeader('...');
grid.attachHeader('...');
grid.setInitWidths('...');
grid.setColAlign('...');
grid.setColTypes('...');
grid.setColSorting('...');
grid.splitAt(2);
grid.enableSmartRendering(true);
grid.init();
grid.parse(data,'json'); // data is defined

Finally, after reading the docs again, I found grid.enableSmartRendering(true); should be after grid.init();
code following works:
var grid = new dhtmlXGridObject('#container');
grid.setImagePath("./bower_components/dhtmlxSuitePro/4.1.1/codebase/imgs/");
grid.enableTreeCellEdit(false);
grid.setHeader('...');
grid.attachHeader('...');
grid.setInitWidths('...');
grid.setColAlign('...');
grid.setColTypes('...');
grid.setColSorting('...');
grid.init();
grid.splitAt(2);
grid.enableSmartRendering(true);
grid.parse(data,'json'); // data is defined

Related

How does one use a CDSView with MultiLine on GMAPPlot?

(First Question so apologies)
Bokeh 1.3.4
Situation:
I am trying top map a Bokeh MultiLine using a CDSView and all the existing examples seem to use the "figure" object which has a helper (multi_line) which accepts a view as an argument. I am doing this on top of a GMAPPlot which does not support multi_line (only MultiLine) (see below). The commented out line throws an error saying GMAPPlot does not support multi_line.
plot = GMapPlot(
x_range=Range1d(), y_range=Range1d(), map_options=map_options, sizing_mode='scale_height'
)
.
.
.
sel_sa1s = []
v_bf = [True if sa1_val in sel_sa1s else False for sa1_val in v_source.data['SA1']]
v_view = CDSView(source=v_source, filters=[BooleanFilter(v_bf)])
v_ml = MultiLine(xs="xs",ys="ys",line_color="black", line_width="w")
#v_rend = plot.multi_line(xs="xs",ys="ys",line_color="black", line_width="w", source=v_source, view=v_view)
v_rend = plot.add_glyph(v_source, v_ml, name='votes')
The snippet shown above works and maps the entire network (very crowded) because there is no filter. What I want to have happen is for the filter to be initialised to hide everything then when the user clicks on an area (SA1) it will display the network related to that SA1.
Actually I can do that but only one area at a time and it would be much more efficient to be able to load the whole map and use a filtered view to control which sub-networks are displayed.
It seems that GMAPPlot only likes the pattern:
create glyph
add glyph
So, my question is - how does one use a CDSView in this environment (how does one add it to the renderer?)
Screenshot of unfiltered data set
It seems that GMAPPlot only likes the pattern:
create glyph
add glyph
That has not been true for some time. There is a higher level bokeh.plotting.gmap function that creates and configures GMapPlot instances with deafult axes, etc, and also has all the same methods and conveniences as figure (e.g. multi_line). It will be much less work to go this route than assembling everything by hand from low-level objects.

Auto-generating widgets in awesome-wm

So what I currently want to do is pretty much implement rofi in awesome.
The reason I want to do this and I don't just use rofi is because I want to learn how to 'auto-generate' widgets in awesome.
This will come in handy later when I'll implement things like network widgets that when clicked, shows you a panel, shows you the wifi hotspots available as rows, etc etc. So it's just for me to learn how awesome works better. But also, I want a program launcher.
And also, before someone suggests it, I already know that there's a built-in launcher in awesome, and I also know that there's this. This is not what I'm looking for. I want to have the same thing thing rofi and dmenu have: I want to have suggestions pop up when you press keys. and I want to be able to click on the suggestions, etc.
What I want is something like this: uhhhh
So what I'm having problems is this: how do I auto-generate the rows? I want to be able to specify in only one place how many rows I want, and have awesome do the rest.
I've looked through Elv's github and I found radical and even though what he made is a menu system, I thought that I could use some of his code to do what I want. But I can't for the love of god figure out how it works. No offense to him, but it's not all too well docummented, even for users, and for actually explaining how the code works there's no docummentation.
So My question is: How can I make this work? How would I go about making the widgets that act as the rows automatically?
TL;DR:
i want to write a program launcher like rofi in awesome
i want to be able to specify only in one place the number of rows
therefore, (((I think))) I need to automatically generate widgets as rows somehow, how can I do it?
EDIT:
What I want is to be able to create the rows of my launcher automatically. I know I can hardcode the rows myself, have each row have a different id and then I can write a function that on each keypress, will update each widget with the most relevant matches. So it would be something like (not tested at all):
local wibox = require("wibox")
local awful = require("awful")
local num_rows = 10
local row_height = 40
-- set the height of the background in accordance to how many rows there are,
-- and how high each row should be
local prompt_height = row_height * num_rows
local prompt_width = 300
-- make a widget in the middle of the screen
local background = wibox({
x = awful.screen.focused().geometry.width / 2 - prompt_width / 2,
y = awful.screen.focused().geometry.height / 2 - prompt_height / 2,
width = prompt_width,
height = prompt_height,
bg = "#111111",
visible = false,
ontop = false
})
local rofi_launcher = wibox.widget({
widget = background,
{
-- get a flexible layout so the searchbox and the suggestion boxes get
-- scaled to take up all the space of the background
layout = wibox.layout.flex.vertical,
{ -- the prompt you actually type in
-- set id here so we can adjust its ratio later, so the magnifying
-- glass will end up on the right, and the texbox will take up the left side
id = "searchbox_and_mangifying_glass",
layout = wibox.layout.ratio.horizontal,
{
-- set id so we can use it as a prompt later
id = "searchbox",
widget = wibox.widget.textbox,
},
{
widget = wibox.widget.imagebox,
icon = '~/path/to/magnifying_glass_icon.svg',
},
},
{ -- this is where I actually create the rows that will display suggestions
{ -- row number 1
-- make a background for the textbox to sit in, so you can change
-- background color later for the selected widget, etc etc.
widget = wibox.widget.background,
{
-- give it an id so we can change what's displayed in the
-- textbox when we press keys in the prompt
id = "suggestion_1",
widget = wibox.widget.textbox,
},
},
{ -- row number 2
-- background, again
widget = wibox.widget.background,
{
-- id and textbox again
id = "suggestion_2",
widget = wibox.widget.textbox,
},
},
-- and another 8 (according to the `num_rows` variable) of the same two
-- textboxes above. This is exactly my problem. How can I make these
-- textboxes automatically and still be able to interact with them to
-- display suggestions on the fly, as the user types keys into the prompt?
},
},
})
If this is not clear enough please do let me know what you don't understand and I will update my question.
Equally untested as your code, but this creates a tables of textboxes instead of using the declarative layout to create all these textboxes:
[SNIP; For shorter code I removed some stuff at the beginning]
local textboxes = {}
local widgets = {}
for i = 1, num_rows do
local tb = wibox.widget.textbox()
local bg = wibox.widget.background(tb)
bg:set_bg("#ff0000") -- The original code did not set a bg color, but that would make the bg widget useless...?
tb.id = "suggestion_" .. tostring(i) -- This is likely unnecessary, but the original code set these IDs, too
table.insert(textboxes, tb)
table.insert(widgets, bg)
end
local rofi_launcher = wibox.widget({
widget = background,
{
-- get a flexible layout so the searchbox and the suggestion boxes get
-- scaled to take up all the space of the background
layout = wibox.layout.flex.vertical,
{ -- the prompt you actually type in
[SNIP - I did not change anything here; I only removed this part to make the code shorter]
},
widgets
},
})
-- Now make the textboxes display something
textboxes[3].text = "I am the third row"
textboxes[5].text = "I am not"

Tab bar item frame bug?

Hello I have a problem with TabBar
I would like to get the frame of a UITabBarItem in a UITabBar, in the past (swift 2) I got the result using :
let frame = self.tabBar.subviews.last?.frame
Now (swift 3) the same command I get a frame that does not have the width of any of UITabBarItem frame.
In particular I tried to print the subviews of self.tabBar
using the code below:
for i in self.tabBar.subviews{
print(i)
}
obtaining this result:
instead seeing the debug view it is clear that the subviews of UITabBar are 3 (_UIBarBackground, UITabBarButton, UITabBarButton).
And if I print the description it is clear that they are different.
any suggestions ? I forgotten anything?
I would like to get the frame of a UITabBarItem
You cannot. A UITabBarItem is not a UIView. It has no frame.

Updating gWidgets elements in R

I'm having trouble updating graphical elements in R and I can't figure it out. I'd appreciate a little push.
I'm trying to make a simple GUI which is prepopulated with some options, but when a button is pressed the database is queried (the query is modified by the GUI), and the result needs to change what's available in the gcomboboxes and gtables. I'm frankly amazed at how simple it is to create such an excellent environment in R.
I don't believe I can modify the body of gcomboboxes or gtables once they're on screen (if I can, that's probably my preferred solution). I also don't believe I can destroy individual elements of a glayout, only the entire glayout. But how do I get it back in the right order?
# Small example for GUI element creation and destruction
if(!require("RGtk2")) {library("RGtk2")}
if(!require("digest")) {library("digest")}
if(!require("cairoDevice")) {library("cairoDevice")}
if(!require("gWidgets")) {library("gWidgets")}
if(!require("gWidgetsRGtk2")) {library("gWidgetsRGtk2")}
nw<-gwindow("Test",toolkit=guiToolkit("RGtk2"))
g<-ggroup(horizontal=FALSE,cont=nw)
t1<-glayout(container=g) # Header
t2<-glayout(container=g) # Dynamic middle
t3<-glayout(container=g) # Footer
t1[1,1]<-gcombobox(c("foo","bar"))
t1[1,2]<-gbutton("Update")
t2[1,1]<-gframe("",container=t2)
t2[2,1]<-gcombobox(c("violin","metal"))
t2[3,1]<-gtable(c("YoYoMa","Metallica"))
t3[1,1]<-glabel("Filler text",container=t3)
delete(g,t2) # Unable to delete t2[2,1] and t2[3,1]
t2<-glayout(container=g)
#t2[2,1]<-gcombobox(c("violin","metal","pop")) ### Nope...
#t2[3,1]<-gtable(c("YoYoMa","Metallica","UB40"))
#add(t2,gcombobox(c("violin","metal","pop"))) ### Nope...
#add(t2,gtable(c("YoYoMa","Metallica","UB40")))
All my added elements go below my footer text. How do I straighten it out so they go between the header and footer?
If I don't delete the glayout, it looks like I can modify the contents of the gcombobox, but the UI doesn't really reflect it. I can see new text when I click the arrow, but the selection no longer appears to change.
...
t2[2,1]<-gcombobox(c("text to remove","violin","metal"))
t2[3,1]<-gtable(c("YoYoMa","Metallica"))
t3[1,1]<-glabel("Filler text",container=t3)
t2[2,1]<-gcombobox(c("violin","metal","pop")) # "text to remove" remains selected regardless of user input
t2[3,1]<-gtable(c("YoYoMa","Metallica","UB40"))
It was a little frustrating, but this is working well for me. I'll leave this solution here in case anybody else has trouble.
# Small example for GUI element creation and destruction
if(!require("RGtk2")) {library("RGtk2")}
if(!require("digest")) {library("digest")}
if(!require("cairoDevice")) {library("cairoDevice")}
if(!require("gWidgets")) {library("gWidgets")}
if(!require("gWidgetsRGtk2")) {library("gWidgetsRGtk2")}
nw<-gwindow("Test",toolkit=guiToolkit("RGtk2"))
g<-ggroup(horizontal=FALSE,cont=nw)
t1<-glayout(container=g) # Header
t2<-glayout(container=g) # Dynamic middle
t3<-glayout(container=g) # Footer
t1[1,1]<-gcombobox(c("foo","bar"))
t1[1,2]<-gbutton("Update")
t2[1,1]<-gframe("",container=t2)
t2[2,1]<-gcombobox(c("text to remove","violin","metal"))
t2[3,1]<-gtable(c("YoYoMa","Metallica"))
t2[3,1]<-gtable(BandList)
t3[1,1]<-glabel("Filler text",container=t3)
t2[2,1][]<-c("violin","metal","pop")
svalue(t2[2,1])<-"pop" #otherwise it's confused about defaults
t2[3,1][]<-c("YoYoMa","Metallica","UB40")
I found a way to edit the contents already on screen without needing to delete the screen elements.
# Small example for GUI element creation and destruction
if(!require("RGtk2")) {library("RGtk2")}
if(!require("digest")) {library("digest")}
if(!require("cairoDevice")) {library("cairoDevice")}
if(!require("gWidgets")) {library("gWidgets")}
if(!require("gWidgetsRGtk2")) {library("gWidgetsRGtk2")}
nw<-gwindow("Test",toolkit=guiToolkit("RGtk2"))
g<-ggroup(horizontal=FALSE,cont=nw)
t1<-glayout(container=g) # Header
t2<-glayout(container=g) # Dynamic middle
t3<-glayout(container=g) # Footer
t1[1,1]<-gcombobox(c("foo","bar"))
t1[1,2]<-gbutton("Update")
t2[1,1]<-gframe("",container=t2)
t2[2,1]<-gcombobox(c("text to remove","violin","metal"))
t2[3,1]<-gtable(c("YoYoMa","Metallica"))
t2[3,1]<-gtable(BandList)
t3[1,1]<-glabel("Filler text",container=t3)
t2[2,1][]<-c("violin","metal","pop")
svalue(t2[2,1])<-"pop" #otherwise it's confused about defaults
t2[3,1][]<-c("YoYoMa","Metallica","UB40")

phpexcel select cell after freezePane()

A) I would like to have a PHPExcel-generated file to open with cell A1 selected. Not a problem: I can do that.
B) I would like to have a PHPExcel-generated file with frozen panes (at 'E6', but that's not the real issue). Again, not a problem: I can do that.
Now, when trying to do A and B, that's when I hit a real problem: the file always opens with cell E6 selected, no matter what I try...
I've tried using
$objPHPExcel->getActiveSheet()->freezePane('E6');
in different stages of the file construction (right at the beginning, at the end, in the middle), always with
$objPHPExcel->getActiveSheet()->setSelectedCell('A1');
AFTER freezing the panes, but no luck...
I searched and searched and found no solution to this (except a perhaps-related-but-unanswered request here at SO). Either I'm overlooking something obviously simple or I've uncovered a small bug... :-) Can someone help?
Many thanks in anticipation.
Looking at the code, The Excel2007 Writer overrides the selected cell when there's a split pane, changing it to the top-left cell of the split.
Quick and dirty fix in Classes/PHPExcel/Writer/Excel2007/Worksheet.php, change line 262 which should read
$activeCell = $topLeftCell;
to
$activeCell = empty($activeCell) ? $topLeftCell : $activeCell;
I haven't tested it fully, but it should work for now.... I really should be testing to see which "pane" the selected cell falls into, and setting appropriately in that pane

Resources