从动态删除数组中的元素(Removing elements from array dynamically)
所以我学会了如何动态地向数组添加元素 - 如何删除它们?
jQuery的
$(document).on('change blur', '.roomFac', function () { var park = $("#park2").val(); var lecturestyle = $("#lecture_style2").val(); var roomstructure = $("#room_structure2").val(); var groupsize = $("#groupSize2").val(); var facilities = ""; $('select[name*=roomFac]').each(function () { facilities += $(this).val(); facilities += ","; }); var dataString = 'park=' + park + '&' + 'lecturestyle=' + lecturestyle + '&' + 'roomstructure=' + roomstructure + '&' + 'groupsize=' + groupsize + '&' + 'facilities=' + facilities; $.ajax({ type: "POST", url: "process_timetableMon2.php", data: dataString, cache: false, success: function (html) { $('#mon').html(html); } }); });
process_timetableMon2.php
$array = explode(",", $_POST["facilities"]); for($i = 0; $i < count($array)-2; $i++){ echo $array[$i].'<br>'; }
我在这里上传了一些代码: http : //jsfiddle.net/kfm5b/3/
So I've learnt how to add elements to an array dynamically - how about removing them?
jQuery
$(document).on('change blur', '.roomFac', function () { var park = $("#park2").val(); var lecturestyle = $("#lecture_style2").val(); var roomstructure = $("#room_structure2").val(); var groupsize = $("#groupSize2").val(); var facilities = ""; $('select[name*=roomFac]').each(function () { facilities += $(this).val(); facilities += ","; }); var dataString = 'park=' + park + '&' + 'lecturestyle=' + lecturestyle + '&' + 'roomstructure=' + roomstructure + '&' + 'groupsize=' + groupsize + '&' + 'facilities=' + facilities; $.ajax({ type: "POST", url: "process_timetableMon2.php", data: dataString, cache: false, success: function (html) { $('#mon').html(html); } }); });
process_timetableMon2.php
$array = explode(",", $_POST["facilities"]); for($i = 0; $i < count($array)-2; $i++){ echo $array[$i].'<br>'; }
I've uploaded some code here: http://jsfiddle.net/kfm5b/3/
原文:https://stackoverflow.com/questions/14922513
更新时间:2024-05-02 11:05
最满意答案
使用Hpaned小部件而不是hbox使树视图可滚动。
Using the Hpaned widget instead of the hbox to make the treeview scrollable.
相关问答
更多-
python pygtk-demo如何将滚动窗口添加到树视图窗口小部件?(python pygtk-demo how to add a scrolledwindow to the treeview widget?)[2022-05-18]
使用Hpaned小部件而不是hbox使树视图可滚动。 Using the Hpaned widget instead of the hbox to make the treeview scrollable. -
您错误地使用了GtkDrawingArea 。 绘图区域不是画布,您只能在其上绘制一次并期望系统刷新绘图; 它是一个小部件,允许(并要求)您在expose事件期间绘制它。 当您需要处理图像时,例如通过将图像缩放到该区域,这非常有用。 如果您只需要一个显示现有图像的小部件,请改用gtk.Image 。 要正确使用DrawingArea ,必须从中进行子类化并处理expose事件。 例如: import gtk, gobject class ImageArea(gtk.DrawingArea): __ ...
-
Gtk.ScrolledWindow()如何工作?(How do Gtk.ScrolledWindow() work? What are the rules/good practices?)[2022-03-27]
好的,我在一个存档的邮件中找到了解决方案(非常感谢你)。 是的,您可以在scrolled_window中放置树视图 。 解决方案是使用 scrolledwindow.set_size_request(x, y) 因为否则滚动的窗口是1px高..?! 这没有正确记录。 这个页面应该引入所有Gtk3 +容器,并附带代码示例。 它没有说Gtk.ScrolledWindow()文档遍布 整个 地方 。 好吧,另一天点击了点击,我希望这条消息可以帮助某人。 OK, I found the solution (tha ... -
PyGTK / Glade - Scrollbars不出现在ScrolledWindow中(PyGTK/Glade - Scrollbars don't appear in ScrolledWindow)[2021-12-10]
简单的解决方法是: TreeView:将Fixed Height Mode设置为No. TreeViewColumn:将“大小调整”设置为“自动”或“仅增长” 对于单列视图,列会调整大小以适合其内容,如果内容不适合,则会显示滚动条。 使用多列视图时,列将获得初始宽度,如果它们不适合,则会显示滚动条。 树视图的“固定高度模式”对于其列来说意味着“固定宽度模式”,但似乎并非如此。 或者,列的固定宽度可以超过ScrolledWindow的宽度,但这是根据需要显示滚动条。 The simple fix was: T ... -
好的...似乎我使用的配置,安装或兼容性存在问题。 我尝试了以下方法: #!/usr/bin/env ruby1.8 然后没有抛出错误,并且后续行工作: sftest = scrollframe.get_frame 现在可以将CheckButton添加到sftest然后我可以滚动查看一个Checkbutton列表... 格尔茨 GG Ok... It seems that there's a problem with my used config, installation or compatibility ...
-
Gio.ActionGroup是一个抽象接口,不能直接构造。 相反,你想要Gio.SimpleActionGroup ,它的insert()方法而不是Gio.SimpleActionGroup 。 Gio.ActionGroup is an abstract interface and can't be constructed directly. Instead you want Gio.SimpleActionGroup, and its insert() method instead of action ...
-
scrolledWindow中的wxpython GridBagSizer无法正常工作(wxpython GridBagSizer inside ScrolledWindow not working)[2023-05-06]
由...创建的子窗口小部件 self.label = wx.StaticText(self, -1, text, wx.DefaultPosition, wx.DefaultSize) 将self作为父级,即MainFrame类。 更改它,以便父级是滚动窗口的实例,如下所示 self.label = wx.StaticText(self.mainPanel, -1, text, wx.DefaultPosition, wx.DefaultSize) The child widgets that are ... -
PyGtk - 在特定行的树视图中设置不可见的复选框(PyGtk - set checkbox in the treeview of a specific row invisible)[2022-02-28]
为可见添加属性并将bool放在树库中,添加行时添加子行时将其置为false。 gtk.TreeStore(str, bool) self.tvcolumn.add_attribute(self.cell1, 'visible', 1) self.treestore.append(None, ['parent %i' % parent, True]) self.treestore.append(piter, ['child %i of parent %i' % ... -
令人惊讶的是,关于这一点的信息很少,可能是因为大多数人只使用一个GUI工具包构建。 但是,我确实发现了 ...... 它似乎从未被证实,但在文档中有一个列表。 不确定这是否有帮助,但我希望如此。 It is amazing how little information there is about this, probably because most people just build with one GUI toolkit. However, I did find this... It never a ...
-
第一次错过了真正的原因。 问题是您要向视口添加多个窗口小部件(只能有一个窗口小部件)。 gtk_viewport_add: assertion 'gtk_bin_get_child (bin) == NULL' failed 转换为:“视口没有子节点的断言是错误的”,因为你已经添加了一些内容。 您需要将所有容器打包到另一个容器中, 然后将其添加到视口中。 It worked with an HBox/VBox, that was the only problem there. However now tha ...