How to add Image in jqGrid
Microsoft Net Framework

How to add Image in jqGrid

 

How to add Image in jqGrid

how to add dynamic button in jqGrid

 formatter: function (cellValue, options, rowObject) {

                        var markup = "<a title=\"%ToolTip%\" href=%Href%;>%Text%</a>";
                        if (rowObject.ImageURL)
                        {
                            var replacements = {
                                "%Text%":"تصویر دیکھیے",
                                "%ToolTip%": "", "%Href%": "javascript:FinalSelection.openAddEditModal(&apos;" + rowObject.person_id + "&apos;)"
                            };
                        }
                        else
                        {
                            var replacements = {
                                "%Text%":"", // if no image hide button
                                "%ToolTip%": "", "%Href%": "javascript:FinalSelection.openAddEditModal(&apos;" + rowObject.person_id + "&apos;)"
                            };

                        }
                      
                        

                        
                        markup = markup.replace(/%\w+%/g, function (all) {
                            return replacements[all];
                        });
                        return markup;
                    }
                }     

 function RightsHolderPhoto(cellvalue, options, rowObject) // Generate img control and set its path
    {
       
       var html = "<img   height='70' width='100' src='"+cellvalue+"'/>";
      
    }


add column in grid as below

 colModel: [
                { name: "ImageURL", formatter: RightsHolderPhoto, width: 20 }


row select and cell select


 onCellSelect: function (rowid,
                iCol,
                cellcontent,
                e) {
             
              

             //   var rowData = $(this).jqGrid("getRowData", rowid);
               //// alert(rowData);
              //  alert(rowData.Image);
              
            },
            onSelectRow: function (rowid) {

                var rowData = $(this).jqGrid("getRowData", rowid);
                alert(rowData);
                var colData = rowData["person_id"];
                alert(colData);
              
            },
           

Share This with your friend by choosing any social account


Upcoming Articles
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM
03
07

New Messages

George Floyd
  • Edit Post Edit This Post within a Hour
  • Hide Chat Hide This Post
  • Delete Chat If inappropriate Post By Mistake
  • Report Inappropriate Chat
  • 4.5kb
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks