首页 \ 问答 \ 在gridview yii2中设置宽度图像(Set width image in gridview yii2)

在gridview yii2中设置宽度图像(Set width image in gridview yii2)

如何在yii2中的gridview小部件中设置宽度图像?

我一直在使用这种方法来显示图像。 yii2中的gridview中的图像


how to set width image in gridview widget in yii2?

I've been using this method to display the image. Image in gridview in yii2


原文:https://stackoverflow.com/questions/22677501
更新时间:2022-11-07 20:11

最满意答案

使用原始数组声明时:

var menu_items_p =
[
    [   //Products
        ['Health Care', 'products/health.php'],
        ['Aroma Therapy','products/scents.php'],
    ],
            [      // Empty
             ],
    [   //Test
        ['What ever', 'spirulina/about.php'],
    ]
]

在IE8中发生错误,但在IE9中没有。 只需删除两个逗号:

var menu_items_p =
[
    [   //Products
        ['Health Care', 'products/health.php'],
        ['Aroma Therapy','products/scents.php'] // here comma removed
    ],
            [      // Empty
             ],
    [   //Test
        ['What ever', 'spirulina/about.php'] // here comma removed
    ]
]

一切都必须正常。


AS suggested by Yoshi and ThiefMaster, I made it following, and this is what solved it:

for(var i=0;i<menu_items_p.length;i++)
if (menu_items_p[i] !== undefined)
for(var j=0;j<menu_items_p[i].length;j++)
if (menu_items_p[i][j] !== undefined)
menu_items_p[i][j][1]='http://127.0.0.1/'+menu_items_p[i][j][1];
  1. Global vars replaced.
  2. Check for undefined.

It's a pity they didn't answer in a formal way, so I would have to answer my self :) Thanks everyone!

相关问答

更多
  • 使用原始数组声明时: var menu_items_p = [ [ //Products ['Health Care', 'products/health.php'], ['Aroma Therapy','products/scents.php'], ], [ // Empty ], [ //Test ['What ever', 'spirulina/about.php ...
  • 当然,可以将代码中的最后一个for循环向量化,因为每次迭代都不依赖于之前迭代中计算的值。 但说实话,这并不像我想的那么容易...... 我的方法比现在的循环快大约800到1000倍。 我使用下划线将大写数组和变量名替换为小写名称。 大写通常保留给python中的类。 这就是你的问题中奇怪的代码着色的原因。 if sensor_num > 0: mask = ( # create a mask where the condition is True ((shadows[:, :, 0 ...
  • 仅供参考,如果在响应中正确设置了标题,则不需要调用JSON.parse 。 (Content-Type:application / json)。 尽管ID重复,但您的代码似乎在此示例中正常工作。 看到单击选择框时显示所有5个选项。 还有multiple HTML属性可以执行您想要的操作。 var content = [{"id":"2","name":"albert"},{"id":"2","name":"john"},{"id":"3","name":"mac-millon"},{"id":"4","na ...
  • 唉唉。 我明白你在做什么。 你非常正确的是,你得到的file标签,因此一个有效的数组的css键: blueprint blueprint/screen.css general general.css ...
  • 他们显然迭代了数组$fruits 。 声明并填充超出给定代码段的范围。 $fruits包含给定字段的对象。 创建一个类,然后填充$fruits 。 “当说”插入多个记录......“时,我理解”不止一行“,我错了吗?” - 它表示从0到N行。 They iterate over array $fruits apparently. It is declared and filled out of scope of given code snippet. The $fruits contains object ...
  • 我的问题是在我声明一个新数组的部分,如果有一个已经命名为ai []的数组,我可以像这样直接初始化吗? 你可以按照你的要求去做,但它不会像你期望的那样工作。 将数组传递给该函数时,实际上每次都会将引用传递给同一个数组。 这意味着如果你得到链接到名称“1”的数组并修改它,你也将修改数组为“2”和“3”,依此类推。 array2包含类似“[I @ 1fc4bec”的值。 但它应该包含一个数组。 所以,这里发生的事情是你做过这样的事情 int[] array2 = namedArrays.get(i); Syste ...
  • 使用嵌套列表理解: >>> a = [[1, None, 2], [3, 4, 5], [6, None, 7]] >>> [[0 if x is None else x for x in sublist] for sublist in a] [[1, 0, 2], [3, 4, 5], [6, 0, 7]] 或者您只需查看每个子列表中的第二个项目的备选方法: >>> [x[:1] + ([0] if x[1] is None else x[1:2]) + x[2:] for x in a] [[1, 0 ...
  • 你的问题确实缺乏一些信息,我的答案是做了很多假设,特别是因为你把classLabel放在一个Set ,我假设你也可以使用其他类型的集合,在这种情况下是Map 。 private static void weatherForecast() { String[] keys = {"Sunny Hot High False No", "Overcast Hot High False Yes", "Rainy Mild ...
  • 术语与语言紧密相关,并且非常令人困惑。 在C ++中, “enumerat ion” ( enum )是一个名称 ,意思是“一堆编号的项目”,因此没有任何行动 ; 这只是一件事 (像一个class )。 当然,“迭代”是指一个动作 ,意思是“多次重复动作”。 通常,这会伴随着一系列项目。 但是,在某些语言中,每个人都有一个特定的含义: C#:枚举器是通过集合的项目的对象 (如C ++迭代器; IEnumerator )。 迭代器是几乎完全相同的方法 ,但是在协程式( yield return )中。 ...
  • 我会选择一个cell阵列,以实现更清晰,更直观的实现,并减少约束。 nIterations = 500; J = cell(nIterations, 2); for i=1:nIterations length_x = randi(100); % random size of J1 J{i,1} = randi(100, length_x, 1); % J1 J{i,2} = randi(i); % J2 end 此外,您还可以获得一些额外的好处,例如: 访问单元格数组中的元素 J ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。